Running Windows Vista
Using Cygwin
Now everytime something is printed on to the screen it's always in white colour. How can I get different colours ?
Thanks
Running Windows Vista
Using Cygwin
Now everytime something is printed on to the screen it's always in white colour. How can I get different colours ?
Thanks
Using gcc under cygwin, you can use ANSI Escape sequences
Eg.
Code:#define ESC "\032" printf( ESC "[2J" ); /* clears screen */
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Actually, AFAIK, you can use ANSI escape sequences as long as ANSI.SYS is loaded into memory, Cygwin or no.
If you want to use a lot of coloured text and screen clearing and other fancy stuff, consider a library like ncurses. (I believe it comes with Cygwin -- it did with mine at least.)
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
No intention of hijacking this thread. However, since Cygwin has been mentioned, I have a quick question: Is Cygwin a way of not to have to use MinGW port of gcc in Windows?
That's correct. However, Cygwin is more restricting than MinGW, DLL-wise. Programs using MinGW's GCC (e.g. compiled with Dev-C++) don't require any special DLLs or anything that I know of, besides standard Windows ones. Programs compiled with Cygwin do: cygwin.dll and cygwin1.dll, I think.
On the other hand, Cygwin is much more complete. It has bash. I mean, look at all of the packages! http://cygwin.com/packages/
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Yeah, I would phrase it more like: is MinGW a way not to use Cygwin?However, Cygwin is more restricting than MinGW, DLL-wise. Programs using MinGW's GCC (e.g. compiled with Dev-C++) don't require any special DLLs or anything that I know of, besides standard Windows ones. Programs compiled with Cygwin do: cygwin.dll and cygwin1.dll, I think.
Of course, if you want to be able to run configure scripts and such with MinGW, you also need to use MSYS, and even then the support for GNU/Linux tools is far more minimal than Cygwin.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Here is one more tutorila Change color.
ssharish