我正在尝试打印“你好世界”在斑马打印机TTP 2030。
std::ofstream of;
of.open("Zebra TTP 2030");
if (of.is_open())
{
debug(std::string("open : ok"));
of << ticket.generateCode(); // return std::string
// ^XA^FO50,50^ADN,10,10^FDHello World^FS^XZ
of.flush();
of.close();
}
else
debug(std::string("open : ko"));在控制台中,"open : ok“是跟踪。
我在微软XP Pro (VM)上。我正在研究Visual 2010。打印机安装在VM上。
有人知道为什么一张票不被创建吗?
发布于 2014-06-30 13:37:56
从命令行打印内容的方法是使用print。打印,TechNet
因此,您可以通过从应用程序调用print来实现您想要的结果。例如。
#include<fstream>
#include<string>
#include<cstdlib>
void print_to_file(string filename){
std::ofstream printer(filename);
printer<<"Hello";
}
//create file with contents to print
int main(){
std::string filename("print_this.tmp");
print_to_file(filename);
std::string command("print \\d:\\\\ServerName\\PrinterName ");
std::system(command + filename);
}正如TechNet文章所指出的,打印机名称有几个选项。
发布于 2014-06-30 13:11:01
您已经创建了一个名为"Zebra 2030“的文本文件,您的文本就在其中。
C++没有将输出发送到打印机的标准方法--您必须查阅Microsoft来了解它是如何完成的。
https://stackoverflow.com/questions/24490857
复制相似问题