home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!math.fu-berlin.de!fub!einoed!bitcave!chamber.in-berlin.de!hausutzu
- From: hausutzu@chamber.in-berlin.de (Utz-Uwe Haus)
- Subject: Random access files under TC++???
- Message-ID: <1993Jan20.185339.19456@chamber.in-berlin.de>
- Organization: Zombie's Burial Chamber, Berlin, West Germany.
- Date: Wed, 20 Jan 1993 18:53:39 GMT
- Lines: 23
-
- Hello,
- I'm currently writing a small database for a friend's company and encountered
- the following problem:
- 1) I save the records in a fstream file, build 2 indexes for easier search
- (everything okay so far)
- 2) When I try to change the content of a record (read it, change the
- appropriate data and try to write it back, it gets appended to the end of the
- file, although I opened the file ios::out (I also tried ios::out|ios::app and a
- seekg to the required position and ios::out|ios::ate and seekg()). In addition
- to the wrong position for the rewrite the file sometimes is corrupted
- afterwards, making read-access for my build_index() - function impossible.
-
- If there is some general error in my concept - (or some fine c++-specific I
- missed ) *please* let me know.
- If there is some code available for automatic RandomAccessFiles - that would be
- even better (sorry - I can't ftp, but mail is okay)!!
- P.s. My last idea would be to copy all preceding records to a new file, append
- the new one and copy the rest of the original file and then rename to the
- original, but thats pretty disk-intensive, right :->>>?
-
- Utz-Uwe Haus
- root%pse@chamber.in-berlin.de
-
-