Saving to a file in C# [on hold]
- by user36322
If I use this code:
using (StreamWriter streamWriter = new StreamWriter("Content/player.txt", true))
{
streamWriter.Write("Hello!");
streamWriter.Close();
}
The program will not actually add "Hello!" to the file.
However, if I use this code:
using (StreamWriter streamWriter = new StreamWriter("C:/Users/Michael/Documents/Visual Studio 2010/Projects/PuzzleGame/PuzzleGame/PuzzleGameContent/player.TXT", true))
{
streamWriter.Write("Hello!");
streamWriter.Close();
}
The program will work as intended and add "Hello!" to the save file. Is there any way I can do this without hardcoding the path?