ZPL Example for Visual C++

Example printing directly to the Parallel Port:

//This program demonstrates how ZPL can be used in Visual C++//
//Zebra Technologies//

#include <fstream.h>
int main()
const int MAX =25;//defining MAX
char buffer [MAX]; //defining buffer

cout <<"Enter the NAME to be printed";//output to screen
cout <<endl;//new line
cin.getline(buffer, MAX,'\n');//input NAME  here
cout << endl;//new line
cout << "Printing...\n";//Printing... to be displayed on screen
ofstream fout; //declare file-stream handle
fout.open("lpt1:", ios::out); //open out to lpt1:
fout<<"^XA^FO35,35^A0,50,50^FD"<<endl;//zpl being sent to screen
fout<<buffer<<endl; //this is the NAME being sent to lpt1
fout<<"^FO35,100^A0,25,25^FDZebra Technologies^FS"<<endl;//zpl
fout<<"^FO35,140^A0,25,25^FDVernon Hills, IL^FS"<<endl;//zpl
fout<<"^FO35,180^A0,25,25^FD847-913-2259^FS"<<endl;//more zpl
fout<<"^XZ"<<endl; //sending end of zpl
fout.close(); //close file 
return 0;