Write type is ok but read type not.

Blitz3D Forums/Blitz3D Beginners Area/Write type is ok but read type not.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What is wrong on the following code.
		Filein =ReadFile ("Data/TopScore.Dat")
		;If file Not exist Then creat one.
		If Filein =0
			FileOut=WriteFile("Data/TopScore.Dat")
			If fileout = 0 Then End; We expand this later
				For x = 1 To 10
					TP_HighScore(x)\Name$ = "NOBODY"
					WriteString (FileOut,TP_HighScore(x)\Name$)
					TP_HighScore(x)\Score = 0
					WriteString (FileOut,TP_HighScore(x)\Score)
					TP_HighScore(x)\date$ = CurrentDate$()
					WriteString (FileOut,TP_HighScore(x)\Date$)
					TP_HighScore(x)\Level = 0
					WriteString (FileOut,TP_HighScore(x)\Level)
				Next
			CloseFile(FileOut)
			Filein =ReadFile ("Data/TopScore.Dat")
		EndIf
		For x = 1 To 10
			TP_HighScore(x)\Name$ = ReadString$( filein )
			TP_HighScore(x)\Score = ReadInt( filein )
			TP_HighScore(x)\Date$ = ReadString$( filein )
			TP_HighScore(x)\Level = ReadByte( filein )
		Next
	    CloseFile(filein)


To write to a file is no problem. All the data is written. But when i want to read this back in to the program i only get the first line in the rest stays empty.