Как вывести данные на принтер?
#include <fstream>
using namespace std;
int main()
{
char* s = "Epson";
int n =1234;
ofstream ofs;
ofs.open("LPT1");//PRN,COM,AUX ПРОБОВАЛ НИЧЕГО!
ofs<<s<<n<<endl;
ofs<<'\x0C';
return 0;
}
Как вывести данные на принтер?
#include <fstream>
using namespace std;
int main()
{
char* s = "Epson";
int n =1234;
ofstream ofs;
ofs.open("LPT1");//PRN,COM,AUX ПРОБОВАЛ НИЧЕГО!
ofs<<s<<n<<endl;
ofs<<'\x0C';
return 0;
}
Клуб программистов работает уже ой-ой-ой сколько, а если поточнее, то с 2007 года.
26 июня 2009 в 18:03
ofs<<s<<n<<endl<< flush;
//=======
SUMMARY
This article presents three methods an application can use to send output to a printer.
MORE INFORMATION
Method 1
The first method uses the fprintf() function with the preopened "stdprn" stream. The following code example demonstrates this technique:
#include <stdio.h>
main()
{
fprintf(stdprn, "a line of text\n");
}
This method works only in the MS-DOS operating system because the "stdprn" stream is not defined by Microsoft Windows or Microsoft Windows NT.
Method 2
Another method uses the fopen() function to open the LPT1, LPT2, or PRN device as a file and uses the fprintf() function to write data to the file handle returned by fopen(). The following code example demonstrates this technique:
#include <stdio.h>
main()
{
FILE *stream;
stream = fopen("PRN", "w");
fprintf(stream, "a line of text\n");
}
This method works in Windows NT as well as the MS-DOS and Windows operating systems.
Method 3
Finally, in MS-DOS, an application can use the int86() or int86x() functions to call one of the following BIOS printer services provided by Interrupt 17h:
service 0: send byte to the printer.
service 1: initialize the printer.
service 2: get printer status.
26 июня 2009 в 18:02
Попробуй перед return поток закрыть.