home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / msdos / programm / 12311 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.5 KB  |  33 lines

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