LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

OpenFile: File does not exist, known bug?

Hi,
I've created an application that converts *.rdf Files (RawDataFile) to *.csv Files. The application worked fine since months. But now I found an exception in the OpenFile function (formatio.h): someone created a filename with a blank before the .rdf extension. When my program tries to open the file this function ends in the error "File not found". I wonder that other editor applications (like UltraEdit or Notepad) showed no problems opening this file. The Filename pointer contains the full path and filename. So I examined that file. After a while I found out that the OpenFile function succeeded when removing this blank before the extension. Now my question: is this a known bug within that function? In the OnlineHelp I coul
dn't find any hints to limitations or conventions.

Thanx
0 Kudos
Message 1 of 3
(3,063 Views)
Are you using CVI 6 ? I just tried the following, and had no problems with it:

#include
#include
#include

int main (int argc, char *argv[])
{
int f;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */

f = OpenFile("c:\\test .rdf", VAL_READ_WRITE,
VAL_OPEN_AS_IS,
VAL_BINARY);

if (f == -1) {
DebugPrintf( "ERROR: %s\n",
GetFmtIOErrorString(
GetFmtIOError()) );
}
else {
DebugPrintf( "Successfully opened the file\n" );
CloseFile(f);
}

return 0;
}


David McClelland
National Instruments
Message 2 of 3
(3,063 Views)
With CVI 6.0 and Windows 2000, I could not duplicate your problem. I tried spaces in the path, in the file name, immediately before the dot (in the file name), immediately after the dot (in the extension). I tried browsing to the file with FileSelectPopup, I tried a hard-coded string constant, I tried reading the name from a string control. It all worked for me. I never got an error from OpenFile.
Message 3 of 3
(3,063 Views)