problem with write data to a file


Recommended Posts


I sudenly having some problem with write data to a file. for exampl the code below

private.handle = file.Open("C:\DATAFILE\CO2_O2_H2S.csv",0,1,1,1)



I tried ro run the program on some computer, it write fine, but some computers, it won't write.

I had many write sequences and some of them write successfully and some of them just create the file name but don't write information into the file.

When I click on the file name that data won't write into it, a message pop up and say the "file is read only". I checked on the file properties and there was no check on the "read only". The file name that data will write into it don't have the message like that.

I created a test program with a write to a file that has the same name to the file's name that data won't write to. For example, the file' name from program1 is C:\speed.csv and when program1 running, data will not be written into speed.csv. (program1 has 8 write sequences as described above). Program to will have a write sequence to write to a file that has the same name as program1 (C:\speed.csv ), and when I run the write sequence on program 2, data was written sucessfully into C:\speed.csv.

I know this should be some problem with windows, but if any of you have this problem before or know how to fix it, could you share with me


Link to comment
Share on other sites

This is almost certainly a Windows security issue. Windows 7, for example, doesn't really let you write to the root directory (c:\), as well as other system type folders like program files, without administrative privileges. The UAC can sometimes grant temporary access, but its on a program basis, and DAQFactory is unlikely to trigger it. You might try running DAQFactory with administrator privileges, by changing its shortcut, but that will surely trigger a UAC prompt on startup. I'd just write to a different directory.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.