Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mstan!chuck From: chuck@Morgan.COM (Chuck Ocheret) Newsgroups: comp.unix.internals Subject: Re: Need efficient way to read file in reverse Message-ID: <1802@s5.Morgan.COM> Date: 27 Sep 90 15:38:30 GMT References: <1990Sep18.152818.1303@phri.nyu.edu> Organization: Morgan Stanley, & Co., Inc. / New York City, NY Lines: 15 I recommend that you check to see if your system supports some form of memory mapping of a file. On some systems there is the mmap(2) call on others a version of shmat(2) allows you to do mostly the same thing. Not all systems provide such a mechanism. When you map a file in using either of these you get a pointer to memory which maps directly to a specified file on the file system (can also be a device). This gives you full random access to all bytes in the file. Read it backwards, forwards, or however you wish; your file has just become a char *. ~chuck -- +--------------------+ Chuck Ocheret, Sr. Staff Engineer +---------------+ |chuck@APT.Morgan.COM| Morgan Stanley & Co., Inc. |(212) 703-4474 | | Duty now ... |19th Floor, 1251 Avenue of the Americas|for the future.| +--------------------+ New York, N.Y. 10020 USA +---------------+