print out of c code

This is a discussion on print out of c code within the C Programming forums, part of the General Programming Boards category; how to take the printout of the output of a c program through a command in the program itself and ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    2

    Unhappy print out of c code

    how to take the printout of the output of a c program
    through a command in the program itself
    and this should happen on the click of a button on the output screen

  2. #2
    Helper
    Join Date
    Jun 2004
    Posts
    255
    Quote Originally Posted by yviswanadham
    how to take the printout of the output of a c program
    through a command in the program itself
    and this should happen on the click of a button on the output screen
    Once compiled and linked, the so-called C-program is not anymore a C-program (the sources are separated from the executable).

    Unless you still have an acces to the sources, you are not able to print out the program with the executable only.

    If you still have an access to the sources (the latter being placed on a well defined place), you can printout them like any text file.

    The only point is to have a complete list of source files. It could help if you have an access to the makefile and parse it. Quite a job...
    Emmanuel Delahaye

    "C is a sharp tool"

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,505
    Unless of course the post was really about quines
    http://www.nyx.net/~gthompso/quine.htm

    It is very vague as to what is required.

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    If you meant about redirecting the output of a program into a file you can readily print, use this example:
    Code:
    c:\> dir > output.txt

  5. #5
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    DOS/Windows:
    Code:
    FILE *pp = fopen("LPT1", "w");
    
    fprintf(pp, "I am printing!\n\f");
    fclose(pp);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 23
    Last Post: 04-20-2009, 07:35 AM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest: The Results
    By Stack Overflow in forum Contests Board
    Replies: 29
    Last Post: 02-18-2005, 04:39 PM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  5. Replies: 4
    Last Post: 01-15-2002, 11:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21