<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to SysFile Library - Write .txt</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/859b09f54f/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/859b09f54f/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/859b09f54f/</id><updated>2020-04-17T15:53:03.222000Z</updated><subtitle>Recent posts to SysFile Library - Write .txt</subtitle><entry><title>SysFile Library - Write .txt</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/859b09f54f/?limit=25#3db9" rel="alternate"/><published>2020-04-17T15:53:03.222000Z</published><updated>2020-04-17T15:53:03.222000Z</updated><author><name>Comingback4u</name><uri>https://forge.codesys.com/u/comingback4u/</uri></author><id>https://forge.codesys.comf24b7c864743d4748ef34a6f690f3d1b210ca390</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Use $R$N for a newline.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>SysFile Library - Write .txt</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/859b09f54f/?limit=25#62fb" rel="alternate"/><published>2020-04-17T07:29:26.833000Z</published><updated>2020-04-17T07:29:26.833000Z</updated><author><name>dgm-mt</name><uri>https://forge.codesys.com/u/dgm-mt/</uri></author><id>https://forge.codesys.comb5acb3f17048608b1d932adb2dd2f66cf6f3b301</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;First of all, I am pretty new working with CodeSys v3.5 and this is my first question here on this webpage, I´m not sure if this is the correct way to do it...&lt;/p&gt;
&lt;p&gt;What I´m trying to do using the "SysFile" library, is create a .txt file and write some info in there.&lt;br/&gt;
I can create the file, and I can write into it, but what I can´t do is create a new file on this document.&lt;br/&gt;
For example, I need the next:&lt;br/&gt;
Line 1&lt;br/&gt;
Line 2&lt;br/&gt;
But, what I have always is:&lt;br/&gt;
Line1 Line2&lt;br/&gt;
I tried "$n", "LF", and a lot of command that I found on internet but I can´t make it work.&lt;/p&gt;
&lt;p&gt;This is what I have programmed:&lt;/p&gt;
&lt;p&gt;VAR&lt;br/&gt;
Aux_OpenFile : BOOL;&lt;br/&gt;
Aux_Texto1 : BOOL;&lt;br/&gt;
Aux_CloseFile : BOOL;&lt;br/&gt;
File_Name : STRING;&lt;br/&gt;
pResult : POINTER TO SysFile.RTS_IEC_RESULT;&lt;br/&gt;
FileHandle : SysFile.RTS_IEC_HANDLE;&lt;br/&gt;
Texto_1 : STRING;&lt;br/&gt;
Texto_2 : STRING;&lt;br/&gt;
Texto_3 : STRING;&lt;br/&gt;
END_VAR&lt;/p&gt;
&lt;p&gt;//Open File&lt;br/&gt;
IF Aux_OpenFile THEN&lt;br/&gt;
File_Name := 'd:/test.txt';&lt;br/&gt;
FileHandle := SysFileOpen (szFile:=File_Name, am:=AM_WRITE, pResult:=pResult);&lt;br/&gt;
Aux_OpenFile := FALSE;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;//Write File&lt;br/&gt;
IF Aux_Texto1 THEN&lt;br/&gt;
SysFileWrite (hFile:=FileHandle, pbyBuffer:=ADR(Texto_1), ulSize:=5, pResult:=pResult);&lt;br/&gt;
SysFileWrite (hFile:=FileHandle, pbyBuffer:=ADR(Texto_2), ulSize:=1, pResult:=pResult);&lt;br/&gt;
SysFileWrite (hFile:=FileHandle, pbyBuffer:=ADR(Texto_3), ulSize:=5, pResult:=pResult);&lt;br/&gt;
Aux_Texto1 := FALSE;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;//Close File&lt;br/&gt;
IF Aux_CloseFile THEN&lt;br/&gt;
SysFileClose (hFile:=FileHandle);&lt;br/&gt;
Aux_CloseFile := FALSE;&lt;br/&gt;
END_IF&lt;/p&gt;
&lt;p&gt;Thanks in advance to anybody that can help me.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Diego&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>