readExact Problem

Charma Motoko_Kusanagi at web.de
Fri May 25 00:02:49 PDT 2007


hello,
I have following problem i can't solve for a whole day:
I got a file in which there are alternating 1 byte in which a name-lengh is saved, then the name, then another byte with a name length and so on...
Now i got this piece of code:

scope uint t;
scope char VFSfile[][];
scope char[] temp;
for(int i=0;i<AmoundVFS;i++)
{
	index.readExact(&t, 1);
	writefln(t);
	index.readExact(VFSfile.ptr, t); // <-- error here "array bounds something
	index.readExact(VFSfile.ptr, t); // this way cauzes Error: not enough data in stream, eventhough i have checked that t is correctly read and the file is big enough
}

AmoundVFS is the amound of entries, index is the File which i loaded with "File"...
now this aborts with the very first entry. what i want is, that the VFSfile has all the names in an array in the end. in a way like this:
VFSfile[0] => "name1",
VFSfile[1] => "name2",
and so on...

anyone can help?!?



More information about the Digitalmars-d mailing list