LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Printer Problems

Hi,

This may not be the correct forum but I'll post my problem in hopes someone may be able to offer me help.

My OS is Windows 2000 Pro and the CVI version is 6.0. The printer is a dot matrix Epson 850 (installed using the build-in Win2K driver) and is attached to a non-networked computer using the parallel port (LPT1:)

The printer works fine with Notepad, Wordpad, etc but I cannot open it programatically within CVI. The code I use is:

FILE *fp;

fp = fopen("LPT1:","w");

The variable 'fp' is always null after the fopen call. As a side note, everything worked fine using Windows 98. Any help on what I'm doing wrong?

Cheers and thanks,
George Hodgson
0 Kudos
Message 1 of 3
(2,742 Views)
I would guess that the problem is in the printer driver. Windows 2000 support for old printers is less than stellar. Click here to search Epson.com for an updated printer driver, but I didn't see one for a xx-850 dot matrix printer for Windows 2000. They have drivers for old printers for old Windows versions.

Look here for some other ideas.

You can also try a couple of different methods instead of fopen:
If you need to print a line at a time, build a string (e.g. myData) and try
PrintTextBuffer (myData, "LPT1");
If you can wait to print a bigger chunk of data, write the data to a file then use
PrintTextFile ("myOutputFile.txt", "LPT1");
If other applications are working with the printer, you could call use one of them to print the file, e.g. use ActiveX to tell Word to print the file or use notepad by calling
system("notepad /p \"d:\\my documents\\myOutputFile.txt\"");
0 Kudos
Message 2 of 3
(2,733 Views)
Thank you for your reply. The reason I want to use fopen() is because I need
to send a series of setup control codes to the printer. The example you
suggest using a system call to Notepad may be my best option.

Regards,
George Hodgson


"Al S" <x@no.email> wrote in message news:201985@exchange.ni.com...
I would guess that the problem is in the printer driver. Windows 2000
support for old printers is less than stellar. Click <a
href="http://www.epson.com/cgi-bin/Store/support/SupportIndex.jsp?BV_UseBVCo
okie=yes&oid=-10236&infoType=Overview" target=_blank>here</a> to search
Epson.com for an updated printer driver, but I didn't see one for a xx-850
dot matrix printer for Windows 2000. They have drivers for old printers for
old Windows versions.<br><br>Look <a
href="http://forums.ni.com/ni/board/message?board.id=180&message.id=13535"
target=_blank>here</a> for some other ideas.<br><br>You can also try a
couple of different methods instead of fopen:<br>If you need to print a line
at a time, build a string (e.g. myData) and try<br>PrintTextBuffer (myData,
"LPT1");<br>If you can wait to print a bigger chunk of data, write the data
to a file then use<br>PrintTextFile ("myOutputFile.txt", "LPT1");<br>If
other applications are working with the printer, you could call use one of
them to print the file, e.g. use ActiveX to tell Word to print the file or
use notepad by calling<br>system("notepad /p \"d:\\my
documents\\myOutputFile.txt\"");


0 Kudos
Message 3 of 3
(2,707 Views)