shf@well.UUCP (Stuart H. Ferguson) (09/10/88)
Here's a weird question: When writing IFF files, it's important to know if the file you're writing to is "seekable," that is, the file can be randomly accessed. Disk files are seekable, but pipes may not be. So the question is, given a DOS FileHandle (or filename or something) is there a way to tell if the file is seekable? For example, the file "df0:foo" is, and the file "pipe:foo" is not. Any way to tell this in general? Is there a way to query the handler, for example? Also, what happens if you try to seek on a pipe? An error? A Guru? Or does it work sometimes and not others? Any info appreciated. The sooner we can get all these little details ironed out, the sooner there will be an iff.library. Thanx. -- Stuart Ferguson (shf@well.UUCP) Action by HAVOC (shf@Solar.Stanford.EDU)
jesup@cbmvax.UUCP (Randell Jesup) (09/12/88)
In article <7066@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes: >When writing IFF files, it's important to know if the file you're >writing to is "seekable," that is, the file can be randomly accessed. >Disk files are seekable, but pipes may not be. So the question is, >given a DOS FileHandle (or filename or something) is there a way to tell >if the file is seekable? The only solution at the time being is to attempt a Seek(). It should return an error if it is not supported. >Also, what happens if you try to seek on a pipe? An error? A Guru? Or >does it work sometimes and not others? Any proper pipe returns an error (probably ERROR_ACTION_NOT_KNOWN), but you should check for any error. -- Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup
cmcmanis%pepper@Sun.COM (Chuck McManis) (09/12/88)
In article <7066@well.UUCP> shf@well.UUCP (Stuart H. Ferguson) writes: > Here's a weird question: > ... given a DOS FileHandle (or filename or something) is there a way > to tell if the file is seekable? Well you could always try sending it an ACTION_SEEK (or whatever) packet and see if it works. Or call Seek() and see if that works. > Also, what happens if you try to seek on a pipe? An error? A Guru? > Or does it work sometimes and not others? Depends on the person writing the pipe. Most folks probably wouldn't include the ability to seek since there is no meaning associated with what it means to seek. Others might make up their own policies and go for it. In the IFF case since your "files" are nearly always going to be bigger than a pipe buffer you will probably want to build the complete file in memory and _then_ stuff it out through a pipe or what have you. Also it makes for the ultimate in buffering and hence speed of output. --Chuck McManis uucp: {anywhere}!sun!cmcmanis BIX: cmcmanis ARPAnet: cmcmanis@sun.com These opinions are my own and no one elses, but you knew that didn't you.