Answers for "unity add to txt file"

C#
0

unity add to txt file

public void WriteToFile(string filename, string data) 
    {        
        string FILE_PATH = "D:/" + filename; //full path to file 
        using (FileStream fs = new FileStream(FILE_PATH, 
          FileMode.Append))// set FileMode.Append to add data to file
                           // set FileMode.Create to create new file 
                           //   or overwrite existing file
        {
            using (StreamWriter writer = new StreamWriter(fs)) 
            {
                writer.Write(data);
            }
          
            fs.Close();
            fs.Dispose();
        }
    }
Posted by: Guest on July-14-2020

C# Answers by Framework

Browse Popular Code Answers by Language