LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read file in LabViewwith a DLL create in CVI get problem with EOF

I have writen a CVI program that reads a text file till the EOF comes. I made a DLL out of it and call this DLL in LabView. In CVI the EOF returns -2 in LabView not. So I get an runtime error . Is there any way to use this CVI DLL.
0 Kudos
Message 1 of 5
(2,751 Views)
CVI made dlls should work in dll. Can you post your example code? Is there any text with error -2?
0 Kudos
Message 2 of 5
(2,736 Views)
I write two short program in CVI that reads in a text file with a frequency list One a DLL and on as calling program to test the DLL. It is in one workspace an works fine. Than I use the DLL in LabView. I made a VI. It didn't get the EOF also no frequency values ?

I put all in a Zip file.

Thomas
0 Kudos
Message 3 of 5
(2,729 Views)
Hi Thomas,

the problem is not a EOF problem. Can you please explain the following construct:

if (Load_Save_Info.RunFlag == 0 )
{
MakePathname (filename,DEFAULT_CHANNEL_TERRESTRIAL, filename);
strcpy(FileToRead,filename);
}
else
FileSelectPopup("","*.txt",".txt", "Select file",VAL_SELECT_BUTTON,0,0,1,0,FileToRead );

if (DLL == ON)
{
FileSelectPopup ("", "*.txt", ".txt", "Load file", VAL_LOAD_BUTTON,0, 0, 1, 0, filename); //(*)
String_Length_All = StringLength (filename);
}


You always read the "FileToRead" whatever the enquiry returns. That means if you change the line (*) to

FileSelectPopup ("", "*.txt", ".txt", "Load file", VAL_LOAD_BUTTON,0, 0, 1, 0, FileToRead);

it works. I've tested in LabVIEW.

Regards

Kai Kratt
NI
0 Kudos
Message 4 of 5
(2,721 Views)
Hallo Kai

Thanks a lot that was the point.

I take that sammle out off an existing program so the construct is related to that.

with best regards

Thomas
0 Kudos
Message 5 of 5
(2,712 Views)