Thanks for the answers guys. I mean I will use the f* operations.
But they are really safe? There is anything that I can do for extreme situations in case to avoid bad memory access? --- Wilker LĂșcio http://about.me/wilkerlucio/bio Kajabi Consultant +55 81 82556600 On Thu, Oct 20, 2011 at 12:09 AM, Don Quixote de la Mancha < quix...@dulcineatech.com> wrote: > On Tue, Oct 18, 2011 at 9:22 AM, Jens Alfke <j...@mooseyard.com> wrote: > > On Oct 17, 2011, at 9:26 PM, Wilker wrote: > > if the user is acessing a > >> file from an external drive, and the file has 8gb, I only wanna read > 64kb, > >> so, I don't wanna read it all just for 64kb. > > > > Just use fopen/fseek/fread/fclose. Mapping in the entire file just so you > can read 64kb is overkill. > > Specifically, if you fseek to the beginning of where you want to read, > then fread what you want, the only part that will get cached is what > you read. It will be faster than not caching. > > mapping the file then reading from memory also caches parts of the > file, but only what you read. > > If you're going to read your file in large chunks then it will be > faster to use the open(), lseek(), read() and close() system calls. > The "f" calls from stdio use an in-process cache which is faster for > small accesses but slower for large ones. > > > -- > Don Quixote de la Mancha > Dulcinea Technologies Corporation > Software of Elegance and Beauty > http://www.dulcineatech.com > quix...@dulcineatech.com > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/wilkerlucio%40gmail.com > > This email sent to wilkerlu...@gmail.com > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com