| | |
How to code a program that can show color text output???
![]() |
Looks like Narue is in the usual good mood this morning.
You have to forgive! Good person though!
I took BCX, the basic to C translator, and figured it out in 5 minutes flat. Here is the C code. You may throw in a little C++ lingo. The name of the WinApi header may be different with your compiler. Play with k a little to get the feel!
Actually, programming can be fun ...
a man, sorry, person over machine thing!
You have to forgive! Good person though!
I took BCX, the basic to C translator, and figured it out in 5 minutes flat. Here is the C code. You may throw in a little C++ lingo. The name of the WinApi header may be different with your compiler. Play with k a little to get the feel!
C Syntax (Toggle Plain Text)
// change text color in Windoze console mode // colors are 0=black 1=blue 2=green and so on to 15=white // colorattribute = foreground + background * 16 // to get red text on yellow use 4+14*16 // tested with Pelles C (vegaseat) #include <stdio.h> #include <windows.h> // or other WinApi header int main() { HANDLE hConsole; int k; hConsole = GetStdHandle(STD_OUTPUT_HANDLE); for(k = 1; k < 25; k++) { SetConsoleTextAttribute(hConsole, k); printf("%2d %s\n", k, "I want to be nice today!"); } getchar(); // cheap wait return 0; }
a man, sorry, person over machine thing!
May 'the Google' be with you!
Do you now see what happens vegaseat? If you give them the answer then they'll stop thinking for themselves--assuming they thought for themselves in the first place--and expect you to continue giving them the answer. The goal here is not to solve the problems of others, but to teach others how to solve their own problems.
>Do u know how to let the text in the program blink???
I know how to make text blink, but I'm not going to tell you because one method is easy to figure out using what you just learned.
>Do u know how to let the text in the program blink???
I know how to make text blink, but I'm not going to tell you because one method is easy to figure out using what you just learned.
I'm here to prove you wrong.
![]() |
Other Threads in the C Forum
- Previous Thread: algorithm uses in scheduling between RAM and CPU
- Next Thread: Open GL
| Thread Tools | Search this Thread |
adobe ansi api array asterisks binarysearch calculate centimeter changingto char convert copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax database directory fflush file fork forloop frequency givemetehcodez global grade graphics gtkgcurlcompiling hacking highest histogram homework i/o inches infiniteloop input interest iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate looping loopinsideloop. lowest match meter microsoft mysql number open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc process program programming pyramidusingturboccodes radix read recv repetition research reversing scanf scheduling segmentationfault send sequential socket socketprograming stack standard string suggestions systemcall threads turboc unix user variable voidmain() wab win32api windows.h windowsapi





