If I save a text file in NotePad how can I read into my program.?Also How can I detect when there is a new line character code in the text file (for lists)? Appreciate any help - Thank you
Reading Text files
BlitzMax Forums/BlitzMax Beginners Area/Reading Text files Hi m8. Here is some code I use to save highscores!
To save!
To Load!
To save!
success=CreateFile("high.txt") If Not success RuntimeError "error creating file" file=WriteFile("high.txt") If Not file RuntimeError "failed to open test.txt file" For i=0 To 9 For j=0 To 1 WriteLine file, highscores$[i,j] Next Next CloseStream file
To Load!
file=ReadFile("high.txt") If Not file RuntimeError "failed to open high.txt file" For i=0 To 9 For j=0 To 1 data$=ReadLine (file) highscores$[i,j]=data$ Next Next CloseStream file
After you get that working you really should create some kind of system for encrypting highscore data. You want people making high scores with your game instead of Notepad. ;)
OK - Thanks guys! - that worked great I thought that maybe it was in a special file format or something and I was looking in the wrong place in the docs. Thanks again! :)