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.


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

How to specify width of custom view?

java android view size android-view

I'm having trouble trying to set a specific size for the width of my custom view. I know I can just hard-code a value in the layout_width field in the XML file but I'm trying not to result to hard-...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.