martindavey
Programmer
Could you maybe tell me what I am doing wrong here??
I am trying to print direct to the printer in W98 using MS Visual C++ am getting no errors opening the stream (My printer is known as lpt1 on my system) but no printer activity is witnessed.
I know in C, W98 makes it next to impossible to print directly but am learning C++ and my course work says it should work as below but it does not.
Any suggestions would be great!
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int main()
{
// tried ofstream no change
fstream Print;
// tried "LPT1" no change
Print.open("lpt1",ios:ut);
// function returns 1 hence stream opened ok
if(!Print.is_open())
{
cout<<"Error Opening File, Program Aborted";
exit 1;
}
// WHY WHY WHY BOOHOOOHOO
Print<<"WHY DOESNT THIS PRINT!\n";
return 0;
}
I am trying to print direct to the printer in W98 using MS Visual C++ am getting no errors opening the stream (My printer is known as lpt1 on my system) but no printer activity is witnessed.
I know in C, W98 makes it next to impossible to print directly but am learning C++ and my course work says it should work as below but it does not.
Any suggestions would be great!
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int main()
{
// tried ofstream no change
fstream Print;
// tried "LPT1" no change
Print.open("lpt1",ios:ut);
// function returns 1 hence stream opened ok
if(!Print.is_open())
{
cout<<"Error Opening File, Program Aborted";
exit 1;
}
// WHY WHY WHY BOOHOOOHOO
Print<<"WHY DOESNT THIS PRINT!\n";
return 0;
}