I am attempting to send information to a parallel printer and I am having problems with the CloseFile function in the code fragment below. When I run the application, the following error is displayed on the CloseFile line: Library function error (return value == -1[0xffffffff]). General I/O failure. The application will print the first time through the FOR loop, but will stop at the closefile statement. I am running LabWindows/CVI 5.5 on a Windows 2000 operating system, with the same error on XP as well.
This error in the executable will allow the first print operation to work, but all subsequent printing won't take place.
// Test App
#include
#include
char file[24];
int fhdl;
int i;
int main (void){
for (i=0; i < 3; ++i){
Fmt (file, "PRN");
fhdl = OpenFile (file, VAL_WRITE_ONLY, VAL_APPEND, VAL_ASCII);
FmtFile(fhdl, "8732-0208 FUNCTIONAL TEST LIMITS\n" );
FmtFile(fhdl,"\n\n\n\n\n\n\n\n");
CloseFile (fhdl);
}
}
//End of App