Hi,
What is the best way of storing data out to a file on a network, which will be later read in again programmatically. Target platform for the program is Linux (Fedora), but it will need to write out a file to a Windows (XP) machine
This needs to be in C++, there will be a high number of write / read events so it needs to be efficient, and the data needs to be written out in such a way that it can be read back in easily.
The whole file may not be being read back in, I'll need to search for a specific block of data in the file and read that back in.
Will simple binary stream writer do? How should I store the data - XML?
Anything else I need to worry about?
UPDATE : To clarify, here are some answers to peterchen's points
Please clarify:
* do you only append blocks, or do you also need to remove / update them?
I only need to append to the end of the file, but will need to search through it and retrieve from any point in it
*** are all blocks of the same size?**
No, the data will vary in size - some will be free text comments (like a post here) others will be specific object-like data (sets of parameters)
*** is it necessary to be a single file?**
No, but desirable
*** by which criteria do you need to locate blocks?**
By data type and by timestamp. For example, if I periodically write out a specific set of parameters, in amognst other data, like free text, I want to find the value of those parameters at a cerain date/time - so I'll need to search for the time I wrote out those parameters nearest that date and read them back in.
*** must the data be readable for other applications?**
No.
*** do you need concurrent access?**
Yes, I may be continuing to write as I read. but should only ever do one write at a time.
*** Amount of data (per block / total) - kilo, mega, giga, tera?**
Amount of data will be low per write... from a number of bytes to a coupe hundred bytes - total should see no more than few hundred kilobytes possible a fwe megabytes. (still unsure as yet)
**> If you need all of this, rolling your own will be a challenge, I would definitely
recommend to use a database. If you need less than that, please specify so we can recommend.**
A database would over complicate the system so that is not an option unfortunately.