GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 06-Sep-2005, 09:32
Peter11111 Peter11111 is offline
New Member
 
Join Date: Jul 2005
Posts: 16
Peter11111 is on a distinguished road

Printing C code in colour


Does anybody know of a method to print C code in colour instead of the hard to follow black and while.
  #2  
Old 06-Sep-2005, 11:50
L7Sqr L7Sqr is offline
Member
 
Join Date: Jul 2005
Location: constant limbo
Posts: 148
L7Sqr has a spectacular aura aboutL7Sqr has a spectacular aura about
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  
Old 06-Sep-2005, 12:02
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,258
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
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  
Old 06-Sep-2005, 12:06
maprich maprich is offline
Member
 
Join Date: May 2005
Posts: 163
maprich has a spectacular aura aboutmaprich has a spectacular aura about
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  
Old 06-Sep-2005, 19:18
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,258
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by maprich
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.
Not true. Printing in color simply means a printer code sequence (sequence of ASCII characters) preceeds the text to be printed, then a reset back to black after the text. Nothing graphical about it.

For example, the string:
Code:
This is $r6green$r0 but this is $r3blue$r0, let's be colorful!
displays
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  
Old 06-Sep-2005, 21:00
maprich maprich is offline
Member
 
Join Date: May 2005
Posts: 163
maprich has a spectacular aura aboutmaprich has a spectacular aura about
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  
Old 07-Sep-2005, 01:26
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,258
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all
Quote:
Originally Posted by maprich
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.
No the codes are different for most brands. Search the web for your printer brand. The models for a brand are pretty much the same.
__________________

Got a cough? Go home tonight and eat a whole box of Ex-Lax. Tomorrow, you'll be afraid to cough.
-- Pearl Williams
  #8  
Old 07-Sep-2005, 05:38
kobi_hikri's Avatar
kobi_hikri kobi_hikri is offline
Regular Member
 
Join Date: Apr 2005
Location: Israel
Posts: 431
kobi_hikri has a spectacular aura aboutkobi_hikri has a spectacular aura about
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 GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 11:31.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.