[comp.sys.ibm.pc] DOS Function 42h

cjdb@sphinx.UUCP (03/12/87)

Simple question: has anyone used this function to move a file pointer
backwards? Peter Norton says "The byte offset in CX:DX is a 32-bit
unsigned long integer." (Programmer's Guide, p. 310). Ray Duncan
implies that with method codes 1 or 2, a byte offset from either the
current location or the end of file may be given as a positive or
_negative_ double integer (Advanced MSDOS, p. 345). He goes on to say,
"Using method 1 or 2, it is possible to set the file pointer to a
location that is before the start of the file." (p. 346) To me this
implies that the pointer can be moved backwards. However, I've tried
moving the pointer a few bytes backwards with method 1, and although
the negative sign flag was on, DOS function 3Fh (read file) seems
never able to find any more data to read (that is, it's as if the file
pointer had been moved past the end of file).

Any enlightenment as to how this really works would be welcome.


-- 
"... ain't nobody's business if I do."		..!ihnp4!gargoyle!sphinx!cjdb  
	-- Billie Holiday     			    PMRCJDB@UCHIMVS1.Bitnet

backman@interlan.UUCP (Larry Backman) (03/16/87)

In article <1262@sphinx.UChicago.UUCP> cjdb@sphinx.UChicago.UUCP (Charles Blair) writes:
>
>Simple question: has anyone used this function to move a file pointer
>backwards? Peter Norton says "The byte offset in CX:DX is a 32-bit
>unsigned long integer."
>However, I've tried
>moving the pointer a few bytes backwards with method 1, and although
>the negative sign flag was on, DOS function 3Fh (read file) seems
>never able to find any more data to read (that is, it's as if the file
>pointer had been moved past the end of file).
>
>Any enlightenment as to how this really works would be welcome.
>
>
>

	Through a glass darkly ....

	A few years ago I had reason to write a set of file system primitives
	that randomly accessed a file.  I remember having problems moving
	the pointer backwards, getting disgusted with DOS, cursing , and
	resorting to brute force.. I ended up always moving the file pointer
	to byte 0 of the file and moving forwatd to the appropriate place
	within the file.  This was under DOS 2.0 and 2.1, I too am curious..
	you should be able to back up a file pointer! 


						Larry Backman
						Micom - Interlan, Inc.