This program listing from the book "C By Example" (QUE pub. 1993) page 538, "Writing to a Printer" does not work for me.
I'm using WIN98 and Borland TURBO C++ 3.1 and
Borland C++4.0. The program is compiled as print.c using the IDE
option. The Printer is an HP DeskJet 832C.
The code suggested by 'moi' will not compile while using Borland Turbo C++ 3.1, but does compile when using Borland C++ 4.0.
But the output would not go to the printer.....
The suggestion from Salem confuses me (I'm new to programming).
Do not know the correct format to use at the Command line (is this the DOS C prompt?). Or should the "print file.txt" be included in the C program?
Program listing from the book:
/*Writing to a printer */
prnt = fopen("LPT1", "w");
fprintf(prnt, "This is a test.\n");
The output always goes to the screen, not to the printer.
No problem printing the code.
Thanks in advance for any suggestions.