<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Prüfen ob Datei existiert wenn nicht neu erstellen</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/</id><updated>2024-07-01T11:20:09.912000Z</updated><subtitle>Recent posts to Prüfen ob Datei existiert wenn nicht neu erstellen</subtitle><entry><title>Prüfen ob Datei existiert wenn nicht neu erstellen</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/?limit=25#705a" rel="alternate"/><published>2024-07-01T11:20:09.912000Z</published><updated>2024-07-01T11:20:09.912000Z</updated><author><name>andrax</name><uri>https://forge.codesys.com/u/andrax/</uri></author><id>https://forge.codesys.comf76247f19091eae658220d339cc8f8cf1a75c983</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Auch wenn es bissl spät ist, DANKESCHÖN.&lt;br/&gt;
Dann hatte ich mir das richtig gedacht.&lt;br/&gt;
Aus Sicherheitsgründen habe ich die Task gegenseitig verriegelt&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Prüfen ob Datei existiert wenn nicht neu erstellen</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/?limit=50#5db4" rel="alternate"/><published>2024-06-04T06:58:07.976000Z</published><updated>2024-06-04T06:58:07.976000Z</updated><author><name>Hismoon</name><uri>https://forge.codesys.com/u/hismoon/</uri></author><id>https://forge.codesys.com24f12daef3ce8845348fc930d4416cff6cf4ddbd</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Nur für die Nachwelt.&lt;br/&gt;
Ja, Ressourcen wie Files sollte man optimalerweise nur aus 1 Task schreiben.&lt;br/&gt;
Typischerweise nimmt man da eine nieder-priore, die sich um solche langsamen File- oder Logging-Geschichten kümmert. Dann gibt es auch keine Synchronisations-Probleme.&lt;br/&gt;
Aus mehreren Tasks das zu tun braucht eben diese Synchronisation. Sonst passieren schlimme Dinge.&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Prüfen ob Datei existiert wenn nicht neu erstellen</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/?limit=25#313e" rel="alternate"/><published>2024-02-12T18:08:14.411000Z</published><updated>2024-02-12T18:08:14.411000Z</updated><author><name>andrax</name><uri>https://forge.codesys.com/u/andrax/</uri></author><id>https://forge.codesys.com4a94e12c151b60919f4813e7150e59e8b5a21a4a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Ergänzung:&lt;br/&gt;
Ich habe jetzt &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xExclusive&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;rausgenommen.&lt;br/&gt;
Jetzt funktioniert es.&lt;/p&gt;
&lt;p&gt;Zusatzfrage:&lt;br/&gt;
können 2 Schreibvorgänge in unterschiedliche Dateien parallel ausgeführt werden oder &lt;br/&gt;
ist es besser sie gegeneinander zu verriegeln?&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Prüfen ob Datei existiert wenn nicht neu erstellen</title><link href="https://forge.codesys.com/forge/talk/Deutsch/thread/2b17cd2a32/?limit=25#cc32" rel="alternate"/><published>2024-02-11T17:42:28.639000Z</published><updated>2024-02-11T17:42:28.639000Z</updated><author><name>andrax</name><uri>https://forge.codesys.com/u/andrax/</uri></author><id>https://forge.codesys.com37417a679e1e9ece98eb0ae5d6df581ec4a07832</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;ich ich möchte prüfen ob eine Datei existiert.&lt;br/&gt;
Wenn diese nicht existiert, soll eine erstellt werden und dort hinein geschrieben werden.&lt;br/&gt;
Die Datei wird im Programmlauf mehrfach geöffnet und Daten hinein geschrieben.&lt;/p&gt;
&lt;p&gt;Ich will hier die Funktion File.MODE.MAPPENDPLUS benutzen, das funktioniert aber nicht.&lt;br/&gt;
fopen.xDone bleibt false.&lt;br/&gt;
Hier der Code:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;sFileName&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;sFileName&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;eFileMode&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MODE&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MAPPENDPLUS&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;Neu&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;erstellen&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;und&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;anhängen&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xExclusive&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;xExecute&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;TRUE&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;IF&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;xDone&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;THEN&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nt"&gt;hFile&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;fopen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;hFile&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nt"&gt;sStringToWrite&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nt"&gt;writeIndex&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nt"&gt;SchrittDatenlog&lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="nt"&gt;60&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nt"&gt;END_IF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Wo liegt mein Fehler?&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>