I wish I could use ReadString() without knowing the length.
Maybe a #NIL as length could mean that should read the bytes until it reach the end of file or the end of the universe.
ReadString() "To the Infinity and beyond"
Re: ReadString() "To the Infinity and beyond"
A Hollywood string is not limited to characters, it can also contain binary data. As documentation explicitly states ReadString is also meant for reading parts of a binary file to memory. Thus it is important to give length. If you just want to read complete file in to memory, you could use either
or more easily:
Code: Select all
size =FileSize("myfilename")
fh=OpenFile(Nil,"myfilename")
mystring=ReadString(fh,size)
CloseFile(1)
Code: Select all
mystring=FileToString("myfilename")
Re: ReadString() "To the Infinity and beyond"
Thanks!
The first method is known by me, but overlooked the FileToString() function.
Hollywood is so huge that my 45 years old head hardly can fight with it
The first method is known by me, but overlooked the FileToString() function.
Hollywood is so huge that my 45 years old head hardly can fight with it