Files - Reading, Writing, Opening, Closing

Miscellaneous Forums/Blitz Showcase/Files - Reading, Writing, Opening, Closing

OK - so this may not be an achievement for most of you, but I just found out how to write data to a *.dat file in Blitz!!
;Type to store info
Type highscore
  Field name$
  Field score%
  Field level%
End Type

best.highscore = New highscore
best\name = Input("Name - ")
best\score = Input("Score - ")
best\level = Input("Level - ")

;open or create a file to write to
scorefileout = WriteFile("score.dat")

;Write info
WriteString(scorefileout, best\name)
WriteInt(scorefileout, best\score)
WriteByte(scorefileout, best\level)

;close the file
CloseFile(scorefileout)

;open the file to read the data
scorefilein = ReadFile("score.dat")

;read info previously stored
read.highscore = New highscore
read\name$ = ReadString$(scorefilein)
read\score = ReadInt(scorefilein)
read\level = ReadByte(scorefilein)

;close the file once reading is done
Print "High Scores:"
Print ""
Write "Name - "
Print read\name
Write "Score - "
Print read\score
Write "Level - "
Print "read\level

WaitKey()
End


OK, I admit to getting it out of the Command Reference in Blitz3D, but I just thought it was awesome. I have a few questions, though:

1) How would I store three different sets of name, score, and level, and read them? Would I have to create a different DAT file for each?

2) What happens if you don't do "CloseFile?" I tried doing it, and nothing noticable happened.

3) Is there a way to store more than one String, Int, and Byte? Such as this:
score = WriteInt(file)
x = WriteByte(file)
y = WriteByte(file)
z = WriteByte(file)
currentgun = WriteString$(file)
name = WriteString$(file)


4) What is the difference between a byte and an int?

1) Just do a loop and store them all.
2) The file will only be closed at the end of execution.
3) Yes, you can store as many of each of them that you want.
4) Byte takes only 1 byte and an Int takes 4 bytes.

How do I read an individual String.
I save two strings:
name = WriteString(file)
name2 = WriteString(file)

How would I read two strings?
nameread = ReadString(file)
nameread2 = ReadString(file)

How does the computer know which string to read?

WriteString(file),name
WriteString(file),name2

nameread = ReadString(file)
nameread2 = ReadString(file)

They are read in the order you wrote them.

Thanks!