More Strings

BlitzMax Forums/BlitzMax Beginners Area/More Strings

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.

ENAy: in your code you're asking it to read a string of length 0 bytes

Global intget:Int '0

Strict
Graphics 640,480,0

Global fileout = WriteFile("moo.txt")
WriteString(fileout, "ARSE")
CloseFile(fileout)

Global wib:String
Global intget:Int=FileSize("moo.txt")
Global filein = ReadFile("moo.txt")
wib = ReadString(filein, intget)
CloseFile(filein)

Repeat
	Cls
	SetColor 255,255,255
	DrawText "TEST",0,0
	
	If wib = "" Then 
		DrawText "EMPTY", 50, 50
	Else
		DrawText wib, 50, 50
	EndIf
	
	Flip
Until KeyDown(KEY_ESCAPE)
End


Any reason you can't use WriteLine() & ReadLine() instead, then you won't have to store sizes.