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++.
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!!!!!!!!!
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:
/* 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
PS You can use freopen() to redirect std streams if you want, but I can't comment on this, having never used it!
I only wrote this for printing on "LPT1":
Maybe it's not the problem in your code, maybe it's your printer.
fprintf(stdprn, "\n\r Hello");
That's all folks. :p