- Joined
- Sep 8, 2007
- Messages
- 1,381
- Reaction score
- 39
Hey guys, I'm basically writing untyped data into a single file and adding them sequentially.
For example
Writebuffer(VersionID,Sizeof(versionID); // will write the version id of the file
len1 := lengthof(string1);
Writebuffer(len1,sizeof(len1)); // will write the size of the length of the string so we can read it
Writebuffer(string1,len1); // will write the string1 to the file
// so if I happen to add multiple file types say I add bitmaps and videofiles and other data types, to read them would be easy I would just read the size of it first then read the datatype but for this to happen I would have to read the file sequentially for example :
Readbuffer(versionid,sizeof(versionID); // reads the first thing in the file since we know the structure
the position moves 4 bytes because versionID is an Int which is 4bytes of data so there fore the filstream.position = 4 right now.
So what I'm wondering is it possible to skip to a particular part of the filestream without having to read everything in a sequencing order? But for that we need to know the size in bytes right? what would be the easiest way to do this ?
For example
Writebuffer(VersionID,Sizeof(versionID); // will write the version id of the file
len1 := lengthof(string1);
Writebuffer(len1,sizeof(len1)); // will write the size of the length of the string so we can read it
Writebuffer(string1,len1); // will write the string1 to the file
// so if I happen to add multiple file types say I add bitmaps and videofiles and other data types, to read them would be easy I would just read the size of it first then read the datatype but for this to happen I would have to read the file sequentially for example :
Readbuffer(versionid,sizeof(versionID); // reads the first thing in the file since we know the structure
the position moves 4 bytes because versionID is an Int which is 4bytes of data so there fore the filstream.position = 4 right now.
So what I'm wondering is it possible to skip to a particular part of the filestream without having to read everything in a sequencing order? But for that we need to know the size in bytes right? what would be the easiest way to do this ?