[comp.sys.amiga.tech] Problems with lseek

smithwik@pioneer.arc.nasa.gov (R. Michael Smithwick -- FSN) (08/05/90)

[]

As anyone else encounted the lseek problem in Manx 5.0b and
know of a workaround?

I want to lseek back to the beginning of a file, and write some
updated info to it. I use lseek(fd,0,0). Trouble is, write()
begins at the end of the file, not where the lseek is supposed to be.

mike

                                       >> mike smithwick <<

Any opinions are my own since nobody else would ever want them.

"Colonize Cyberspace!"

dillon@overload.Berkeley.CA.US (Matthew Dillon) (08/07/90)

In article <55519@ames.arc.nasa.gov> smithwik@pioneer.arc.nasa.gov (R. Michael Smithwick -- FSN) writes:
>[]
>
>As anyone else encounted the lseek problem in Manx 5.0b and
>know of a workaround?
>
>I want to lseek back to the beginning of a file, and write some
>updated info to it. I use lseek(fd,0,0). Trouble is, write()
>begins at the end of the file, not where the lseek is supposed to be.
>
>mike
>
>					>> mike smithwick <<

    Two possible problems:

    (1) You are compiling using 16 bit ints (which is an option under 5.0
	I believe, the default is 32 bits), and did not #include <fcntl.h>,
	thus no prototype and thus the second argument is being passed as
	a short instead of a long.

    (2) You openned the file with the O_APPEND flag.  Any write() to the
	file will always append, period.

    (3) There really is a bug with Aztec.

						-Matt

--


    Matthew Dillon	    dillon@Overload.Berkeley.CA.US
    891 Regal Rd.	    uunet.uu.net!overload!dillon
    Berkeley, Ca. 94708
    USA