I\'m trying to write the contents of an array to a text file. I\'ve created the file, assigned text boxes to the array (not sure if correctly). Now I want to write the con
You may try to write to the file before you close it... after the FileStream fs = File.Create("scores.txt");
line of code.
You may also want to use a using
for that.
Like this:
if ((!File.Exists("scores.txt"))) //Checking if scores.txt exists or not
{
using (FileStream fs = File.Create("scores.txt")) //Creates Scores.txt
{
// Write to the file here!
}
}