I am trying to print just specific string to a line printer. I try to run this snippet but nothing prints out. I am looking also at the list of pending jobs for the printer, and nothing shows when I run the code.
I can print documents just fine from Word, so the printer is available.
Can someone hint at what the 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 is a test printing";
if ( (fprintf(printer, "%s" , text) ) < 0 ){
perror("Printing error");
}
fflush(printer);
fclose(printer);
return 0;
}