Horje
c# create a text file Code Example
c# create a text file
//File and path you want to create and write to
string fileName = @"C:\Temp\Temp.txt"; 
//Check if the file exists
if (!File.Exists(fileName)) 
{
    // Create the file and use streamWriter to write text to it.
	//If the file existence is not check, this will overwrite said file.
	//Use the using block so the file can close and vairable disposed correctly
    using (StreamWriter writer = File.CreateText(fileName)) 
    {
        writer.WriteLine("Hello World");
    }	
}
write text files with C#
// Create a file to write to.
string createText = "Hello and Welcome" + Environment.NewLine;
File.WriteAllText(path, createText);

...

// Open the file to read from.
string readText = File.ReadAllText(path);




Csharp

Related
C# open a new form Code Example C# open a new form Code Example
unity how to copy something to the clipboard Code Example unity how to copy something to the clipboard Code Example
random number generator unity Code Example random number generator unity Code Example
c# get file size in bytes Code Example c# get file size in bytes Code Example
c# random number Code Example c# random number Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7