MAV when using Reading Strings

Blitz3D Forums/Blitz3D Programming/MAV when using Reading Strings

System4 Studios(Posted 2011) [#1]
Ok.. For some reasons I'm getting MAV's when I'm reading a line string that's downloaded for the internet.. For example..

BlitzGet("http://www.system4studios.byethost33.com/servernews.txt",CurrentDir(),"")
fileread=OpenFile("servernews.txt")
serverreadstring1=ReadString(fileread)


If I use ReadLine.. It returns a 0. Can anyone explain why?

Last edited 2011


Floyd(Posted 2011) [#2]
ReadString is intended for specially formatted strings, typically created by Blitz's WriteString command. If you use ReadString on ordinary text the first four bytes will be misinterpreted as an enormous integer length for the rest of the string, hence the MAV.

ReadLine works with plain text. The fact that you get a value of 0, an integer, indicates that the serverreadstring1 variable is an integer when it should be a string.

The type of a variable is determined by a "type tag":

x% or x both mean integer
x# is a floating point number
x$ is a string


System4 Studios(Posted 2011) [#3]
Oh ok.. I got it.. Figured out my careless formatting mistake. Thanks!

Last edited 2011