Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!van-bc!ubc-cs!mprgate.mpr.ca!newshost!krasic From: krasic@tucana.mpr.ca (Charles Krasic) Newsgroups: comp.unix.programmer Subject: reading binary data in C Message-ID: Date: 24 May 91 21:56:34 GMT Sender: news@mprgate.mpr.ca Distribution: comp Organization: MPR Teltech Ltd., Burnaby, B.C., Canada Lines: 21 I'm writing a program which needs to read a chunk of data directly into memory and I'm having trouble deciding what is the _best_ way to do it. I've been considering three possibilities: 1) mmap the chunk of the file into memory with flags set to MAP_PRIVATE 2) malloc a chunk of memory and use either i) fread or ii) fgetc Any of these should work (I think...) but I would like to know which is best. -- Charles Krasic | Voice : (604) 294-1471 MPR Teltech Ltd. | Fax : (604) 293-5787 8999 Nelson Way, Burnaby, BC | E-Mail: krasic@mprgate.mpr.ca Canada, V5A 4B5 | mprgate.mpr.ca!krasic@uunet.uu.net