I have recently been doing an assignment which had us making a text editor. What I was trying to do is to get the terminal screen size so that I could use the coordinates. Can somebody tell me how I can save the environmental variables as integer values? I googled to find that there is a function use_env for getting the screen size. Can anybody write me a small function as an example to better understand how it works? Also, does anybody know what is the Windows version of ncurses for it does not work with windows?
sid78669
0
Junior Poster
Recommended Answers
Jump to PostIf you're using windows, here's a pretty straightforward solution to retrieving the console buffer size.
#include <windows.h> #include <iostream> int main() { CONSOLE_SCREEN_BUFFER_INFO csbi; int ret = GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &csbi ); if ( ret ) { std::cout << "Console Buffer Width: " << csbi.dwSize.X << …
Jump to PostNo -- that code is MS-Windows specific.
ncurses for MS-Windows only works with console programs, not GUI programs. If you want a gui program that is portable to both *nix and windows then don't use ncurses but use something like wxWidgets (there are others too)
All 6 Replies
William Hemsworth
1,339
Posting Virtuoso
sid78669
0
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
sid78669
0
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
sid78669
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.