Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!wuarchive!psuvax1!psuvm!trm900 From: TRM900@psuvm.psu.edu (Tony R. Marasco) Newsgroups: comp.lang.c Subject: Random Access files Message-ID: <90322.032603TRM900@psuvm.psu.edu> Date: 18 Nov 90 08:26:03 GMT Organization: Penn State University Lines: 22 Hello. I am trying to use random access files and have run into some problems... I am using _fopen_ with a "w+b" parameter to create the file (if it doesn't exist). If it exists, I use "r+b". Otherwise it seems to erase the file like PASCAL's _rewrite_. How am I doing so far?? I am also using _fseek_ to position the file pointer (recnum*size of struct) with SEEK_SET. I do this before each _fread_ & _fwrite_. The program seems to "lose" a few bytes at the beginning of each _fread_. What is more astounding is I can write a record that doesn't exist, but I can't update a record that already exists. Any ideas? Is it my fault or Turbo C's? Any help is greatly appreciated. ------- | Tony Marasco | "Questions are a burden for others. | | Penn State University | Answers are a prison for oneself." | | Schuylkill Haven, PA 17976 | - The Prisoner | | trm900@psuvm.psu.edu - or - %s!psuvax1!psuvm.BITNET!trm900 |