It seems that function "OpenFile" doesn't work in Visual C++ while it works in CVI.
Here is a simple testing program.
#include
#include
#include
void main()
{
int hFile;
hFile = OpenFile ("d:\\temp.txt", VAL_READ_WRITE, VAL_TRUNCATE, VAL_ASCII);
if (hFile == -1)
{
MessagePopup("Error", "File not opened");
}
else
{
const char buf[] = "Just Testing.";
WriteFile (hFile, buf, strlen(buf));
MessagePopup("Msg", "File opened and written.");
CloseFile (hFile);
}
}
When this program runs in Labwindows/CVI, the result is "File opened and written" and the buf is written to file. But when it runs in Visua
l C++6.0, the result is "File not Opened".
It seemed that "OpenFile" doesn't work in Visual C++, while "fopen" works.
Does anybody know why?
Thanks.