From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: best way to read selected data from a file? Date: Mon, 25 Oct 1999 17:17:00 -0700 Organization: Harvey Mudd College Lines: 19 Message-ID: <3814F2FC.E501F5CD@hmc.edu> References: <3812949e_2 AT news DOT chariot DOT net DOT au> <7v1vkh$4fv$1 AT news5 DOT jaring DOT my> <3814e8ed DOT 53973068 AT news DOT pasteur DOT dialix DOT com DOT au> NNTP-Posting-Host: mercury.st.hmc.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: nntp1.interworld.net 940897070 1075 134.173.45.219 (26 Oct 1999 00:17:50 GMT) X-Complaints-To: usenet AT nntp1 DOT interworld DOT net NNTP-Posting-Date: 26 Oct 1999 00:17:50 GMT X-Mailer: Mozilla 4.61 [en] (X11; U; Linux 2.2.13pre12 i586) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Kieran Farrell wrote: > > >You can use fread and fwrite to read from and write to random location from > >a file. But you need to specify the length you want to read if you use > >fread. > > Hmm that's actually bad advice, his question was for text files. Once > you use fread or fwrite it automatically makes it a binary file. Not quite true; you can use fread and fwrite on text files. You just have to avoid writing anything that isn't text, or things will break. CR/LF translation could also bite if you are writing in the middle of a file. In short, it is possible, but probably best avoided. -- Nate Eldredge neldredge AT hmc DOT edu