Thread: printer function in C

  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
    London, United Kingdom
    Posts
    226
    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, 11:03 PM
  4. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  5. Question..
    By pode in forum Windows Programming
    Replies: 12
    Last Post: 12-19-2004, 07:05 PM