Luben wrote:Although i dont understand the rest of your post, this part made me look at the IWriteFile-interface and find this method:
Code: Select all
//! Changes position in file
/** \param finalPos Destination position in the file.
\param relativeMovement If set to true, the position in the file is
changed relative to current position. Otherwise the position is changed
from begin of file.
\return True if successful, otherwise false. */
virtual bool seek(long finalPos, bool relativeMovement = false) = 0;
Sylence wrote:Yes seek is the method you are looking for. Exactly the same name as for .NET streams and std::fstream...
Sorry, my brain might have slept. I forgot that I need to write INTO THE LIST, not INTO THE FILE ON HARD DISK. So I just need to load the file byte for byte into the list and format it.
Sylence wrote:However if I get you right you are loading the file, write it, and then load it again? The second load doesn't make sense since you already have all the data you want in memory...
I confess, it's hard to understand. I wanna write an ini file, using a special format. I wanna avoid empty blocks like this:
Code: Select all
[ IrrRenderingOptions ] ;Noticed the whitespaces?
AntiAliasing = 4 ;Once again ...
IsFullscreen = 1 ;One more time ...
First, it looks awful, second, I don't even dream of building-in a 'whitespaceskipper'. So I wanna delete every whitespace-character, for that I need it to load in the memory as a list, for its strucure allows me to delete and insert items in the middle without re-order the whole file - a few months ago, I did some tests with formating files, and a list is some times faster in changes than a array - about 15 times (for each processor core). At this point, the file should look like this:
Code: Select all
[IrrRenderingOptions];That looks way better,
AntiAliasing=4;does it?
IsFullscreen=1
But for a read-out, a list is way to uncomfortable. I can't call the items by its indices (what I need - special for my program), so I need a easy-to-read-array. See?