{"id":667,"date":"2016-12-17T10:42:51","date_gmt":"2016-12-17T10:42:51","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=278"},"modified":"2022-09-13T15:38:03","modified_gmt":"2022-09-13T14:38:03","slug":"text-files","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/files\/text-files","title":{"rendered":"Text Files"},"content":{"rendered":"<h4>\n\tAdd Lines To Text File &amp; Read Back Line By Line<\/h4>\n<pre><code>\n\tStorageFolder Folder1 = ApplicationData.Current.LocalFolder;\n\tStorageFile File1 = await Folder1.CreateFileAsync(\"MyFolder\\\\MyFile.txt\", CreationCollisionOption.OpenIfExists);\n\tif (File1 != null)\n\t{\n\t\tstring[] TagIds = new string[1];\n\t\tTagIds[0] = NewRfidTagId;\n\t\tawait FileIO.AppendLinesAsync(File1, TagIds);\n\t}\n<\/code><\/pre>\n<pre><code>\n\tStorageFolder Folder1 = ApplicationData.Current.LocalFolder;\n\tif (Folder1.TryGetItemAsync(\"MyFolder\\\\MyFile.txt\") != null)\n\t{\n\t\t\/\/File Exists\n\t\tStorageFile File1 = await Folder1.GetFileAsync(\"MyFolder\\\\MyFile.txt\");\n\t\tvar ReadFile = await FileIO.ReadLinesAsync(File1);\n\t\tstring[] TagsToSend = ReadFile.ToArray();\n\t}\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Add Lines To Text File &amp; Read Back Line By Line StorageFolder Folder1 = ApplicationData.Current.LocalFolder; StorageFile File1 = await Folder1.CreateFileAsync(&#8220;MyFolder\\\\MyFile.txt&#8221;, CreationCollisionOption.OpenIfExists); if (File1 != null) { string[] TagIds = new string[1]; TagIds[0] = NewRfidTagId; await FileIO.AppendLinesAsync(File1, TagIds); } StorageFolder Folder1 = ApplicationData.Current.LocalFolder; if (Folder1.TryGetItemAsync(&#8220;MyFolder\\\\MyFile.txt&#8221;) != null) { \/\/File Exists StorageFile File1 = await Folder1.GetFileAsync(&#8220;MyFolder\\\\MyFile.txt&#8221;); var [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[],"class_list":["post-667","post","type-post","status-publish","format-standard","hentry","category-files"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=667"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/667\/revisions"}],"predecessor-version":[{"id":1182,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/667\/revisions\/1182"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}