windows - Printing string text in C does not print -
i trying print specific string line printer. try run snippet nothing prints out. looking @ list of pending jobs printer, , nothing shows when run code.
i can print documents fine word, printer available.
can hint @ problem may be?
#include <stdio.h> #include <stdlib.h> int main() { file* printer = 0; if(( printer = fopen("lpt1", "a+")) == null) { puts("error opening printer"); } char* text = "this test printing"; if ( (fprintf(printer, "%s" , text) ) < 0 ){ perror("printing error"); } fflush(printer); fclose(printer); return 0; }
i think misunderstanding code. code submitted writes string "this test printing" file in same directory called "lpt1".
what wanting write out "/dev/lpt1", , should able test running
echo "this printed text" >/dev/lpt1
Comments
Post a Comment