<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to string write to txt file</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4a98dd3c30/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4a98dd3c30/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/4a98dd3c30/</id><updated>2023-08-09T15:05:33.604000Z</updated><subtitle>Recent posts to string write to txt file</subtitle><entry><title>string write to txt file</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4a98dd3c30/?limit=25#45b3" rel="alternate"/><published>2023-08-09T15:05:33.604000Z</published><updated>2023-08-09T15:05:33.604000Z</updated><author><name>alrcastro</name><uri>https://forge.codesys.com/u/alrcastro/</uri></author><id>https://forge.codesys.com9401a57722e65521eefa7c5a14387915c973b2e3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In addition to the above tip, your program is overlooking error codes for formatting and file access functions; it is always good practice to read these parameters.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>string write to txt file</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4a98dd3c30/?limit=25#586d" rel="alternate"/><published>2023-08-09T12:38:55.989000Z</published><updated>2023-08-09T12:38:55.989000Z</updated><author><name>TimvH</name><uri>https://forge.codesys.com/u/timvh/</uri></author><id>https://forge.codesys.com3309521891216671a8241875b1c5db168b3b5950</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Maybe you should not use SIZEOF, but LEN. Because SIZEOF means you will get the memory size of your string variable (e.g. maximum 80 characters), but LEN will give the actual length of the string.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>string write to txt file</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/4a98dd3c30/?limit=25#404e" rel="alternate"/><published>2023-08-01T07:55:54.403000Z</published><updated>2023-08-01T07:55:54.403000Z</updated><author><name>sarunas</name><uri>https://forge.codesys.com/u/sarunas/</uri></author><id>https://forge.codesys.comcbdee0c0cbc21df06ee2a5a80ad6c06172c86827</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello, I have variable code:&lt;/p&gt;
&lt;p&gt;FOR n:=1 TO 255 DO&lt;br/&gt;
CONCAT2(pSrcString1:=ADR(GlobalPersistent.ReadAllEvents&lt;span&gt;[n]&lt;/span&gt;.sDate),pSrcString2:=ADR(GlobalPersistent.ReadAllEvents&lt;span&gt;[n]&lt;/span&gt;.STime),pDstString:=ADR(GVariable.WriteToFileString&lt;span&gt;[n]&lt;/span&gt;),nDstSize:=255);&lt;br/&gt;
formatStrg:='%s,%s,%s,%s';&lt;br/&gt;
FBFormatString(sFormat:=FormatStrg, arg1:=FSTRING(GlobalPersistent.ReadAllEvents&lt;span&gt;[n]&lt;/span&gt;.sDate),&lt;br/&gt;
arg2:=FSTRING(GlobalPersistent.ReadAllEvents&lt;span&gt;[n]&lt;/span&gt;.STime),&lt;br/&gt;
arg3:=FSTRING(GlobalPersistent.ReadAllEvents&lt;span&gt;[n]&lt;/span&gt;.sSource),&lt;br/&gt;
arg4:=FSTRING(GlobalPersistent.ReadAllEvents&lt;span&gt;[n]&lt;/span&gt;.sMessageText),&lt;br/&gt;
sOut=&amp;gt;GVariable.WriteToFileString&lt;span&gt;[n]&lt;/span&gt;);&lt;br/&gt;
ENDFOR&lt;br/&gt;
I string write to array, when this Array I write to txt file&lt;br/&gt;
fbFileWrite( bExecute := FALSE );&lt;br/&gt;
fbFileWrite( sNetId:=sDestNetId, hFile:=hDestFile,&lt;br/&gt;
pWriteBuff:= ADR(GVariable.WriteToFileString), cbWriteLen:= SIZEOF(GVariable.WriteToFileString),&lt;br/&gt;
bExecute:=TRUE, tTimeout:=tTimeOut );&lt;/p&gt;
&lt;p&gt;I open create file and see this. I attached picture&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>