| | |
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 |
#include * adobe ansi api array asterisks binarysearch centimeter changingto char character cm copyimagefile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax database directory dynamic feet fgets file fork frequency function getlasterror getlogicaldrivestrin givemetehcodez global grade graphics gtkgcurlcompiling gtkwinlinux hacking highest histogram include incrementoperators infiniteloop input interest kernel keyboard kilometer linked linkedlist linux linuxsegmentationfault list locate logical_drives looping loopinsideloop. lowest match matrix meter microsoft mqqueue mysql number odf opendocumentformat owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv repetition research reversing scanf segmentationfault sequential shape single socket socketprograming standard string systemcall threads turboc unix user voidmain() wab whythiscodecausesegmentationfault windows.h windowsapi





