Re: Read & Write Binary Files
- Posted by Larry Miller <larrymiller at sasktel.net> Nov 28, 2006
- 594 views
Pete Lomax wrote: > > On Mon, 27 Nov 2006 12:23:39 -0800, ags <guest at RapidEuphoria.com> > wrote: > > >Pete Lomax wrote: > >> >Curiously enough I don't see a tell() in the Euphoria reference... I guess > >> you have to keep track of that yourself? > >> I think you meant where(). > > > >Ah, thanks for that. That's a bit confusing, considering it's ftell() in > >C... > Well, just to dot the i's; basically (in windows anyway), afaict, both > where and ftell must ultimately be saving results from SetFilePointer, > at least for seek -1, so (cmiiw) both clib and/or eu backend do > manually keep track of it for the app developer. There really is no > such thing as a low-level windows API call Get FilePointer. > > Not that you probably wanted to know. > > Now I think about it, where() may not have been the best choice for > this function (neither is ftell), maybe get_file_position()? > > Regards, > Pete > It is true that Windows dows not have a GetFilePointer function but none is needed. SetFilePointer returns the current file position. SetFilePosition allows setting the position relative to the beginning, current position, or the file end. Using an offset of zero will not alter the file position but will return the current position. DOS has an similar function. I am quite certain that both C and Euphoria will be using this method. Larry Miller