On Nov 10, 9:38 pm, "Bill Reid" <hormelf...@happyhealthy.netwrote:
Just curious...have you ever heard of something called "conio.h"
There's an easier way. For instance on Linux, you can do:
printf("\033[37mHello!");
They call them escape sequences or something like that.
I've already got the code written and working for Linux, and now I'm
writing it for Windows. I had thought that under Windows I might be
able to do:
printf("$e[37mHello!");
but I tried it just there and it didn't work (as far as I know it
worked in DOS). I know under Windows there's a Win32 API function
called "SetConsoleTextAttribute", but I was hoping the above would
work because I'm not too keen on explicitly linking with gdi32.lib,
nor am I keen on including the whore of a file that is <windows.h>.
Anyone know another way of changing the console text colour in
Windows?
Just as an aside, I'm also writing a cross-platform library for
dealing with raw sockets. I pretty much have it simplified to four
functions:
OpenRawsock
SendEthernetFrame
RecvEthernetFrame
CloseRawsock
So far I have it working for Linux and Windows (The Linux version used
Berkeley Sockets and the Windows version uses pcap because WinSock no
longer allows raw sockets). Anyone who's interested can e-mail me.