Printer problem?

This is a discussion on Printer problem? within the C Programming forums, part of the General Programming Boards category; I am having trouble printing a report generated by a program i have created. I want to print a hard ...

  1. #1
    DanTheMan
    Guest

    Unhappy Printer problem?

    I am having trouble printing a report generated by a program i have created. I want to print a hard copy of this report to my printer but it just will not work. Below is all the instructions I have tried, can anyone help me out please. I am using Borland C++.

    fprintf(stdprn,.........
    fprintf(stderr,..........
    fprintf(stdaux,.........

    I have checked help and it says that the streams I have used above are opened automatically. I have tried the above in conjunction with the fopen function and the tried the fprintf but nothing seems to work!!!!!PLEASE HELP ME!!!!!!!!!

    Thanks

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    16
    You can't use standard streams as far as I'm aware,
    you need to define a FILE pointer with an appropriate name, then open the stream 'manually'.

    Try something like this:


    FILE *prn_fp;

    /* some code */

    if( ( prn_fp = fopen( "LPT1", "w" ) ) == NULL )
    /* error code here */


    then fprintf( prn_fp, ........ );

    If LPT1 doesn't work try "PRN"

    LPT1 and PRN are used in Dos, and this works for me using Visual C++ to compile C programs.


    Hope this helps

    Foffo Spearjig

    PS You can use freopen() to redirect std streams if you want, but I can't comment on this, having never used it!
    Last edited by Foffo Spearjig; 01-24-2002 at 12:31 PM.

  3. #3
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Talking

    I only wrote this for printing on "LPT1":

    Code:
    fprintf(stdprn, "\n\r Hello");
    Maybe it's not the problem in your code, maybe it's your printer.

    That's all folks.
    Last edited by GaPe; 01-26-2002 at 12:56 PM.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. half ADT (nested struct) problem...
    By CyC|OpS in forum C Programming
    Replies: 1
    Last Post: 10-26-2002, 09:37 AM
  5. binary tree problem - help needed
    By sanju in forum C Programming
    Replies: 4
    Last Post: 10-16-2002, 06:18 AM

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