printer function in C

This is a discussion on printer function in C within the C Programming forums, part of the General Programming Boards category; Is anybody knows how to print a file in C ? I found the escape, texout, and startdoc()...I am wondering ...

  1. #1
    Unregistered
    Guest

    printer function in C

    Is anybody knows how to print a file in C ? I found the escape, texout, and startdoc()...I am wondering if there is a funciton that I could just pass a filename including the path and the function will print out the whole file . It seems to me those functions I found just can pass a string.

    Thanks so much

  2. #2
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    Munich, Germany
    Posts
    224
    Use this function

    void PrintFile(char* filename)
    {
    char tmp[255];
    FILE *fp = fopen(filename,"r");
    while (fgets(&tmp[0],255,fp)!=NULL) {
    fputs(tmp,stdprn);
    }
    }

    -----
    not been tested, but i think it should work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 10:03 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 01:28 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 06:05 PM

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