LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

I am trying to connect a text file in to my program with labwindows cvi. I used the formating and i/o point library. I used :open file functio

n, read file function,and the close file function.I placed functions in the callback open function,but program states: file not found. So I saved the file in the project window, but that didn�t work.do you know why the lab isn�t being located? ThankyouHere is how I has it set up in my program
//Open text file
file1 = OpenFile ("TEXT.txt", VAL_READ_ONLY, VAL_OPEN_AS_IS,
VAL_ASCII);

//Reading the file
placed_bytes = ReadFile (file1, Bufferdata, 250);

//Close the file
err = CloseFile (file1);
return 0;
tHANK YOU
0 Kudos
Message 1 of 2
(3,106 Views)
n, read file function,and the close file function.I placed functions in the callback open function,but program states: file not found. So I saved the file in the project window, but that didn�t work.do you know why the lab isn�t being located? ThankyouNote that when using the OpenFile function, the first parameter is not just the name of the file, but the whole path to it. For example,
a call to OpenFile("c:\\temp\\Mytext.txt", VAL_READ_ONLY,VAL_OPEN_AS_IS, VAL_ASCII);

should open the file I have on my c:\temp folder with name "Mytext.txt"
We need to escape the backslash in order for the string to be interpreted correctly; otherwise we'll get an error that the path is incorrect.

Hope this helps,

Azucena
Message 2 of 2
(3,106 Views)