![]() |
|
#1
|
|||
|
|||
Printing C code in colourDoes anybody know of a method to print C code in colour instead of the hard to follow black and while.
|
|
#2
|
|||
|
|||
|
I assume that you are speaking about console applications?
You may want to google ansi escape sequences. You can output color using them. Note, however, if you are going to use that approcah on Windows, you will need to check for the ansi.sys file. Alternatively, you can use some Windows built-in functionality. As I am not too familiar with Windows, I will leave that to someone else. |
|
#3
|
||||
|
||||
|
And if you are talking about to the printer, you'd have to search for a printing program that can do the color coding. I don't know of any -- never searched for one. Try the terms "syntax highlight print" in google and see if anything shows up.
__________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#4
|
|||
|
|||
|
Printing in colour, even just text, means graphical printing. And C or C++ doesn't provide any functions to do that. The details of graphical printing depend on the operating system. E.g. in Windows you should use win32 api for the graphical printing. In linux you should create postscript version of the page and direct to the postscript printer device (== file in /dev ). Anyways I happen to use wxWidgets which provides cross-platform functions for graphical printing among other things. Other libraries also exist to simplify the printing. Up to you.
|
|
#5
|
||||
|
||||
|
Quote:
For example, the string: Code:
This is green but this is blue, let's be colorful! on an epson printer. The $ is the character 0x1B (ESC) __________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#6
|
|||
|
|||
|
Thanks Walt for the info. I tought that only plain text would be printed in the line printing mode. I take it that the printing code sequences are the same for all printers... would be pain if not. Anyways I'll experiment with my printer.
|
|
#7
|
||||
|
||||
|
Quote:
__________________
Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough. -- Pearl Williams |
|
#8
|
||||
|
||||
|
I think the dude is talking about printing the application to the printer, As I encountered the same problem .
My solution was to use Devc++ to print the resulting application files to the printer. There are other programs, obviously ... Kobi Hikri. |
Recent GIDBlog
Writing a book by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Formatting C / C++ code | WaltP | C Programming Language | 1 | 07-Jan-2008 00:59 |
| Guidelines for posting requests for help - UPDATED! | WaltP | C++ Forum | 0 | 21-Apr-2005 03:44 |
| Problem with int mixed with char,... | leitz | C++ Forum | 17 | 07-Dec-2004 21:56 |
| Help! Some basal questions about MFC | xutingnjupt | MS Visual C++ / MFC Forum | 1 | 05-Dec-2004 04:38 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The