XNA C# File I/O using a .txt

sorry in advance if this seems trivial. Read a few tutorials/notes and still cannot get my head around this...

I am currently making a puzzle game in which the player controls a character. Each time the character moves "1 map tile" in any 4 way direction (N,S,E,W) an int will +1. The number of this integer is currently displayed on the game screen along with some small text, informing the player of their current "moves".

spriteBatch.DrawString(debugfont, "Moves Taken: " + MoveCounter, Vector2.Zero, Color.White);

What I want to do is take the information that's being stored/displayed above and place it into an external file (.txt) which can then be viewed at a later stage when the user chooses the "HighScores" option from the Main Menu.

Answers


File.AppendText and TextWriter.Write is possible approach:

using(var output = new File.AppendText("highscore.txt"))
{
    output.Write("Moves Taken: {0}", MoveCounter);
}

Need Your Help

Return to first page of Extjs 4 grid

extjs store paging

I developed Extjs 4 grid with paging. In some event I need to refresh the grid and

Are there any samples for appengine Java report generation?

java google-app-engine mapreduce reporting bigtable

We are using AppEngine and the datastore for our application where we have a moderately large table of information containing a list with entries.