[Gambas-user] Read and Write Null
tobias
tobiasboe1 at ...20...
Sun Jul 24 09:52:23 CEST 2011
good morning Benoit,
this issue has kept me awake almost all the night.
if i have an uninitialized collection and want it to be written to and
then read from a file:
Dim cCol As Collection = Null
Dim hFile As File
hFile = Open "~/test" For Write Create
Write #hFile, cCol As Variant
Close #hFile
hFile = Open "~/test" For Read
cCol = Read #hFile As Variant
Print cCol
i get segfault (in Write instruction) and figured out that it is about
this line (in my rev #3944 gbx_stream.c:1116)
if (TYPE_is_object(type)) type = T_OBJECT;
and the switch branch for T_OBJECT which doesn't seem to expect a Null
object (i think... i didn't look very closely to it)
(why am i telling you this, you'll know it better)
so i sat down and manually created my file without Writing Null as a
datatype but as a string:
Write #hFile, "\x0f\x00", 2
and thought that it will at least now succeed but i get an error about
typemismatch (wanted standard type got Null instead). Read also seems
not to expect the Null (there is no T_NULL branch in STREAM_read_type's
switch)
shouldn't it be possible to at least read that Null as it is a standard
type?
regards,
tobi
More information about the User
mailing list