11-22-2006 10:06 AM
11-23-2006 02:31 AM
You could use PrintTextBuffer after setting up a "generic /text only" printer as the default printer in the system.
Try these instructions in the Interactive execution window:
#include <userint.h>
static int _tmp1;
static char msg[16];
msg[0] = 0x1B; // Esc
msg[1] = 0x43; // 'C'
msg[2] = 0x0A; // LF
msg[3] = 0x0;
_tmp1 = PrintTextBuffer (msg, "c:\\temp\\print.txt");
11-23-2006 03:23 AM
Unfortunately the NUL marks the end of the msg buffer and thus would not get sent to the printer. I assume from the original problem that the printer needs to receive this last 00 character to complete its control code sequence.
JR
11-23-2006 10:22 AM
Does the printer have the serial option fitted? If so you could write data to it directly via the CVI RS232 libraries; two of the functions useful here are ComWrt() and ComWrtByte() - these should be capable of including the NUL in the string of bytes to be written to the serial port.
JR
11-24-2006 01:57 AM
I am noticing now that my code does not send text to the printer: it creates a file on disk instead. To print to an actual printer configured as the default printer you must pass an empty string as the second parameter to PrintTextBuffer.
JR solution for a serial printer is surely the best you can find. If your printer is connected to LPT1 instead, and you do need to send NUL characters to it you could try using outp function to write directly to the hardware port of the parallel output (see in hardware manager to detect the correct port number).