<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to File Access Problem</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/827be8e057/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/827be8e057/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/827be8e057/</id><updated>2020-02-27T13:54:56.048000Z</updated><subtitle>Recent posts to File Access Problem</subtitle><entry><title>File Access Problem</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/827be8e057/?limit=25#18e0" rel="alternate"/><published>2020-02-27T13:54:56.048000Z</published><updated>2020-02-27T13:54:56.048000Z</updated><author><name>timvh</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com6cf77a76c03b42b9fa17683d2969f9132c5964fa</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;As I understand it correctly, what you say is in both cases the same.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>File Access Problem</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/827be8e057/?limit=25#ef04" rel="alternate"/><published>2020-02-27T13:54:55.840000Z</published><updated>2020-02-27T13:54:55.840000Z</updated><author><name>yue-qi-qi</name><uri>https://forge.codesys.com/u/yue-qi-qi/</uri></author><id>https://forge.codesys.coma30c72aae299b72f3209ac113d45d245f2c12689</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I have just download the CoDeSys Examples of “FileUtilities”，that writes as：&lt;/p&gt;
&lt;p&gt;IF xInit THEN&lt;br/&gt;
    CASE iState OF&lt;br/&gt;
    0: //Open the specified file with write access.&lt;br/&gt;
       FileOpen(xExecute:= TRUE, sFileName:= sFileName, xExclusive:= FALSE, eFileMode:= File.MODE.MWRITE );&lt;br/&gt;
       IF FileOpen.xDone = TRUE THEN&lt;br/&gt;
           iState := 1;&lt;br/&gt;
           hfile := FileOpen.hFile;&lt;br/&gt;
           FileOpen(xExecute:= FALSE);&lt;br/&gt;
       ELSIF FileOpen.xError = TRUE THEN&lt;br/&gt;
           iState:= 32767;&lt;br/&gt;
           FileOpen(xExecute:= FALSE);&lt;br/&gt;
       END_IF&lt;br/&gt;
...&lt;/p&gt;
&lt;p&gt;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!&lt;br/&gt;
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!&lt;br/&gt;
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!&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>File Access Problem</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/827be8e057/?limit=25#613e" rel="alternate"/><published>2020-02-27T13:54:55.644000Z</published><updated>2020-02-27T13:54:55.644000Z</updated><author><name>yue-qi-qi</name><uri>https://forge.codesys.com/u/yue-qi-qi/</uri></author><id>https://forge.codesys.com246f2f99a9edad5b37fbeb1620eb6cc039c673d6</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I meet a problem when I use the File Access 3.4.1.0 library to operate file access.&lt;br/&gt;
 fbFileOpen:FILE_ACCESS.FILE.Open;&lt;br/&gt;
 fbFileOpen(xExecute:=TRUE,sFileName:=strFileName,eFileMode:=FILE_ACCESS.FILE.MODE.MWRITE,xExclusive:=FALSE);&lt;br/&gt;
 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!&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>