Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!ming!icsu7039 From: icsu7039@ming.cs.montana.edu (Spannring) Newsgroups: comp.unix.programmer Subject: Re: reading binary data in C Message-ID: <4071@dali> Date: 31 May 91 00:27:48 GMT References: Sender: osyjm@dali.cs.montana.edu Distribution: comp Organization: Montana State University, Dept. of Computer Science, Bozeman MT 59717 Lines: 26 In article krasic@tucana.mpr.ca (Charles Krasic) writes: [ lines about wanting to bring a chunk of a binary file into memory deleted ] > > 1) mmap the chunk of the file into memory with > flags set to MAP_PRIVATE I've never heard of mmap before and our man pages haven't either. I would guess it isn't portable, so I'd avoid it. > 2) malloc a chunk of memory and use either > i) fread Probaly not too bad, but if you are bringing in big (>=512 bytes) chunks of data, why not go directly to the system calls and use read? Should be about as fast as you can get. > or ii) fgetc I would guess somewhat slow. -- ==================================================================== Six of one, 110 (base 2) of | Craig Spannring another. | icsu7039@caesar.cs.montana.edu ----------------------------------+--------------------------------