![]() |
Portable alternative to system("cls");?
My current work (learning without a teacher/class means I have to pick a new topic and play with it till I get it) is a regular old console app with 900+ lines of source, not including the header file. I could probably split it up into different files, but that's not the issue here.
This thing has to clear the screen a lot, because a menu is shown after anything you do. So far, as far as I know, anything I've written prior to this will run on any platform you throw it at. But now, however, I can't find something to clear the screen that isn't related to windows, all I know right now are system("cls"); and a win32 API call (which is obviously way over my head). Side question: Can anyone recommend a command line compiler that produces smaller executables? Right now I'm using g++ that came with Dev-Cpp, and the output is usually about 400kb bigger than the MSVS counterpart. |
There is no portable way to clear the screen. Why? Because the type of screen you have varies from system to system. Some systems might not even have a screen. Some might have a teletype. C/C++ does not deal with those things. A particular system's implementation of C/C++ may provide proprietary extensions to deal with those things.
The nearest thing I can think of as a 'portable' way to clear the screen is to feed a lot of newlines. This will, of course, leave the prompt at the bottom. Works on a teletype, too, though ;). If you find MS better than Dev-Cpp (minGW), why don't you use it? The debugger is far better, too. |
Well, that's no fun.
About the last part: I don't really have a preference, I like using g++ since I don't have to open any kind of IDE to do it. I suppose I could download VC++ express and borrow cl.exe with honor, though. |
VC++ is perfectly suitable for command line operations.
You seem to be of the opinion that IDEs are not used by "real men". Welcome to the world of driving nails with a high-heeled shoe. IDEs are tools. People who refuse to use a hammer because high-heeled shoes are manly, are fools. Your "honor" is not honor, it's stupidity. I'll wager that I can run rings around you in a command-line environment. There were no alternatives when I learned this shit. With your attitude, I would fire you in a New York second, if someone had slipped up and hired you to begin with. Tough words. Hope you don't ever get a reasonably intelligent and technically competent boss. |
er..
1. "borrowing with honor" is a funny way some people say "stealing" (probably misused here since I did the same with g++, and didn't know you could go without installing VC++'s IDE in the first place) 2. The reason I'm avoiding using an IDE is cause right now I'm on a computer that's pretty clunky, I don't want to waste any more system resources than I have to. At my own computer, I tend to use IDEs because they make life easier Guess I'll spare no details in any future posts, I didn't think I came off as an asshole. |
Wow, people seem pretty hostile as of late! :confused:
|
| All times are GMT -5. The time now is 3:00 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC