I am doing a personal project to get to know C a little better:
Some essential information
- I have a usb printer
- I am using Windows 7 OS..suggest better Os..haha..not NT or ms-dos ;)
- I am using Visual C++ 2008 Express edition..coding strictly in C however(You can suggest other compilers that would be better to solve the problem)
I want to make a program that while running, has the capabilities to send data to the printer to be printed on paper. I already know that I can write to file and than open notepad and print the code.. I don't want to do that however. Is there a way to send the data to the printer via USB..if only serial is available, I'll take it..but preferably USB
I know others have posted this but their threads are left empty due to no response by themselves...
Any suggestion will be accepted
I've tried
int main()
{
FILE *fp = fopen( "LPT", "w");
if ( fp == NULL ) {
perror( "Unable to open printer" );
}
else
{
fprintf( fp, "Hello World\n\f" );
fclose( fp );
}
getch();
return 0;
}
And nothing...I've changed LPT to PRN, LPT:, LPT1, LPT1:, LPT2(and it's derivatives), file paths..nothing works..They only create files with no file extensions that contain Hello world..