I meet a problem when I use the File Access 188.8.131.52 library to operate file access.
after fbFileOpen() executed,the content of the file that the function block open will be cleard! And the size of the file will be 0!
I have just download the CoDeSys Examples of “FileUtilities”，that writes as：
IF xInit THEN
CASE iState OF
0: //Open the specified file with write access.
FileOpen(xExecute:= TRUE, sFileName:= sFileName, xExclusive:= FALSE, eFileMode:= File.MODE.MWRITE );
IF FileOpen.xDone = TRUE THEN
iState := 1;
hfile := FileOpen.hFile;
ELSIF FileOpen.xError = TRUE THEN
The code above is tested on CoDeSys Control Win V3, and if there has exist a file which the sFileName specifies, and the file size is not 0, but after the above FileOpen() function executed and success with xFone=TRUE.the file size is 0, which means the file which is open with File.MODE.MWRITE mode will be cleared to empty!
In my mind, if you open the file with File.MODE.MWRITE, if the file does not exists, the file will be created and opened;and if the file has existed, then the file will be opened and should be cleared to empty!
But the test above shows that open a file with File.MODE.MWRITE mode means create a new file or clear an existing file to empty!
As I understand it correctly, what you say is in both cases the same.
Log in to post a comment.