Clearing content of text file using C#
How clear all line in text file and write new string?
Clearing content of text file using C#
How clear all line in text file and write new string?
You don’t need C# you can use a Write block (it will overwrite all existing text). If you use Append it will not overwrite and just append at the end of the file.
I need to use add because it is in loop.
I can overcome this issue by writing to the file.
after the loop i get the data by reading the file but i have to clear it every time.
i thought about deleting the file, but i think the hdd might swell
Deleting the file will be just fine
In OB Doesn’t work like here, does it?
Of course it works, but it’s completely equivalent to putting a File Write block and leaving the content field empty same exact thing
same thing but i will write this after the loop
File.WriteAllText(path, String.Empty);
Alternatively,
File.Create(path).Close();
it doesn’t work like this how should i write it
You have to replace path with your path as a string
i do but it doesn’t work
File.WriteAllText("DB\\ALL.txt", String.Empty);
File.Create(("DB\\ALL.txt").Close();
Name ‘file’ does not exist in current context
System.IO.File.WriteAllText("DB\\ALL.txt", String.Empty);
it works very well thnx @Ruri