Home » Community » Forums » DirectX and XNA » Read Data from Txt file
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Read Data from Txt file
Post New Topic  Post Reply 
I want to create a tile based map with the map data stored in a file
the program will read the data one unit at a time and store the char in an array of files

example:
file1.txt
"wwwggww"

in the program I want to do something like:
file.open("file1.txt");
for (int i = 0; i < 7; i++)
file >> tiles[i];

I don't know how to do this in C#

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Look into the IO documentation for C#. You need to use something like System.IO.FileStream(). Here's a random tutorial that looks decent.



Cloud Node // 815.2 | Solariad

 User Rating: 1405   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

thanks, the streamreader part through me off. I was looking for methods under filestream and wasn't finding it.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: