19-03-2009, 01:02 AM
Most probably just stupidity on my part, or lack of knowledge about the Get and Put functions.
I'm wanting to store 3 variable strings using file i/o, and here's what I got:
Storing the string sizes, then the strings themselves;
Loading the size values, then trying to load that many bytes into the string;
The 12 is obviously there because that's the size of 3 longs (4 bytes). I then add the size of the .name to the StartByte field, meaning it should read the .name fine (Shouldn't it?) then each of the other values.
Really doesn't work though. It won't even read .name properly.
I've tried a few variations, such as loading .name from the 12th byte. I have a small recollection of VB6 being silly and starting at 1 instead of 0, unlike pretty much all languages. So would I need to do 13, and add a 1 to the sSize vals?
Any help with the code, or giving me some more understanding of the syntax would help.
Thanks.
I'm wanting to store 3 variable strings using file i/o, and here's what I got:
Storing the string sizes, then the strings themselves;
Code:
Put #f, , Clng(LenB(.name))
Put #f, , clng(LenB(.description))
Put #f, , clng(LenB(.skill))
Put #f, , CStr(.name)
Put #f, , CStr(.description)
Put #f, , CStr(.skill)
Loading the size values, then trying to load that many bytes into the string;
Code:
Get #f, , sSize1
Get #f, , sSize2
Get #f, , sSize3
Get #f, , .name
Get #f, 12 + sSize1, .description
Get #f, 12 + sSize1 + sSize2, .skill
Get #f, 12 + sSize1 + sSize2 + sSize3, .hp
The 12 is obviously there because that's the size of 3 longs (4 bytes). I then add the size of the .name to the StartByte field, meaning it should read the .name fine (Shouldn't it?) then each of the other values.
Really doesn't work though. It won't even read .name properly.
I've tried a few variations, such as loading .name from the 12th byte. I have a small recollection of VB6 being silly and starting at 1 instead of 0, unlike pretty much all languages. So would I need to do 13, and add a 1 to the sSize vals?
Any help with the code, or giving me some more understanding of the syntax would help.
Thanks.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?