Printing from a C program
-
Hi, I am using VC++ 6.0 . I need to print some text from a simple C program. How do I do it? I tried to use fprintf(); but couldn't get a suitable FILE * object to put as the first parameter. Please help. Is there any other way to do it? With best regards, Sayan Email:sayanmukherjee@indiatimes.com
-
Hi, I am using VC++ 6.0 . I need to print some text from a simple C program. How do I do it? I tried to use fprintf(); but couldn't get a suitable FILE * object to put as the first parameter. Please help. Is there any other way to do it? With best regards, Sayan Email:sayanmukherjee@indiatimes.com
printf
(without the leadingf
.) Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
printf
(without the leadingf
.) Joaquín M López Muñoz Telefónica, Investigación y DesarrolloBy the word 'printing', I meant printing to a printer. With best regards, Sayan Email:sayanmukherjee@indiatimes.com
-
By the word 'printing', I meant printing to a printer. With best regards, Sayan Email:sayanmukherjee@indiatimes.com
Oh I see... Well, if you can get by with a simple hack, redirect your standard output to the printer at the command line with
myprogram >LPT1:
or whatever your printer port is named (go to Control Panel->Printers->Properties->Details.) Joaquín M López Muñoz Telefónica, Investigación y Desarrollo -
By the word 'printing', I meant printing to a printer. With best regards, Sayan Email:sayanmukherjee@indiatimes.com
You could try this:
FILE* pPrinter = fopen ("LPT1:", "w");
if (pPrinter != NULL) {
printf (pPrinter, "A line of text\n");
fclose (pPrinter);
}/ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
-
Hi, I am using VC++ 6.0 . I need to print some text from a simple C program. How do I do it? I tried to use fprintf(); but couldn't get a suitable FILE * object to put as the first parameter. Please help. Is there any other way to do it? With best regards, Sayan Email:sayanmukherjee@indiatimes.com
Sayan Mukherjee wrote: I need to print some text from a simple C program. How do I do it? If when you say "print" you mean console, you can use puts(...) or the "stdout" file handle with fprintf(...), fputs(...), etc. If you mean "printer", you may be able to use the stdprn file handle. Peace! -=- James.