*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> ftn/fseek (3)              
Title
Content
Arch
Section
 

Contents


FSEEK(3F)							     FSEEK(3F)


NAME    [Toc]    [Back]

     fseek, fseek64, ftell, ftell64 - reposition a file	on a logical unit

SYNOPSIS    [Toc]    [Back]

     integer function fseek (lunit, offset, from)
     integer offset, from

     integer function fseek64 (lunit, offset64,	from)
     integer *8	offset64

     integer function ftell (lunit)

     integer *8	function ftell64(lunit)

DESCRIPTION    [Toc]    [Back]

     lunit must	refer to an open logical unit.	offset is an offset in bytes
     relative to the position specified	by from. Valid values for from are:

	  0 meaning `beginning of the file'
	  1 meaning `the current position'
	  2 meaning `the end of	the file'

     The value returned	by fseek will be 0 if successful, a system error code
     otherwise.	 (See perror(3F))

     Ftell returns the current position	of the file associated with the
     specified logical unit. The value is an offset, in	bytes, from the
     beginning of the file.  If	the value returned is negative,	it indicates
     an	error and will be the negation of the system error code. (See
     perror(3F))

     Fseek64 and ftell64 are identical in functionality	to their 32 bit
     counterparts except they can operate on files larger than 2 gigabytes in
     some filesystems.

FILES    [Toc]    [Back]

     /usr/lib/libU77.a

SEE ALSO    [Toc]    [Back]

      
      
     fseek(3S),	perror(3F)

ORIGIN    [Toc]    [Back]

     MIPS Computer Systems












									Page 1






FSEEK(3S)							     FSEEK(3S)


NAME    [Toc]    [Back]

     fseek, fseek64, rewind, ftell, ftell64 - reposition a file	pointer	in a
     stream

SYNOPSIS    [Toc]    [Back]

     #include <stdio.h>

     int fseek (FILE *stream, long offset, int whence);

     int fseek64 (FILE *stream,	long long offset, int whence);

     void rewind (FILE *stream);

     long ftell	(FILE *stream);

     long long ftell64 (FILE *stream);

DESCRIPTION    [Toc]    [Back]

     fseek sets	the file position indicator for	the stream pointed to by
     stream.  The new position,	measured in bytes from the beginning of	the
     file, is obtained by adding offset	to the position	specified by whence.

     SEEK_SET	 specified starting point is the beginning of the file plus
		 offset.

     SEEK_CUR	 starting point	is the current value of	the file position
		 indicator plus	offset.

     SEEK_END	 specified starting point is the EOF of	the file plus offset.

     A successful call to fseek	clears the end-of-file indicator for the
     stream.

     fseek allows the file position indicator to be set	beyond the end of the
     existing data in the file.	 If data is later written at this point,
     subsequent	reads of data in the gap will return zero until	data is
     actually written into the gap.  fseek, by itself, does not	extend the
     size of the file.

     rewind(stream) is equivalent to:

	  (void) fseek ( stream	, 0L, SEEK_SET),

     except that the error indicator for the stream is also cleared.  Also,
     rewind returns no value.

     fseek and rewind undo any effects of ungetc(3S) on	the indicated stream.
     After fseek or rewind, the	next operation on a file opened	for update may
     be	either input or	output.






									Page 1






FSEEK(3S)							     FSEEK(3S)



     If	stream is writable and buffered	data has not been written to the
     underlying	file, fseek and	rewind cause the unwritten data	to be written
     to	the file.

     ftell returns the offset of the current byte relative to the beginning of
     the file associated with the named	stream.

     The functions fseek64 and ftell64 are identical to	fseek and ftell
     respectively, except that fseek64 takes a long long as an argument	and
     ftell64 returns a long long.  This	allows the routines to set and return
     the file position indicator for files larger than 2 Gigabytes.

SEE ALSO    [Toc]    [Back]

      
      
     lseek(2), fopen(3S), fsetpos(3S), popen(3S), stdio(3S), ungetc(3S).

DIAGNOSTICS    [Toc]    [Back]

     fseek returns non-zero for	improper seeks,	otherwise zero.	 An improper
     seek can be, for example, an fseek	done on	a file that has	not been
     opened via	fopen; in particular, fseek may	not be used on a terminal, or
     on	a file opened via popen(3S).

WARNING    [Toc]    [Back]

     The ANSI C	Standard restricts the use of offsets, when stream refers to a
     text file.	 When operating	on these files,	the value of offset must be
     zero unless whence	is SEEK_SET.  This restriction is necessary as the
     unit of offsets may not be	bytes on some systems, and arithmetic may not
     meaningfully be performed on them.
     As	the unit of offset on this system (and on most UNIX systems) is	bytes
     for text as well as for binary files, the restrictions indicated in the
     ANSI C Standard are not enforced.	Portable programs, however, should be
     coded accordingly.

     Users of the -n32 compilation model are directed to either	use ftell64
     and fseek64 or fgetpos and	fsetpos	in place of ftell and fseek. The
     reason for	this is	because	the offset argument to fseek, and the return
     value from	ftell are both typed as	long, which is not sufficient to
     express the maximum file length supported by the -n32 compilation model.


									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
maplun IRIX returns the integer file descriptor for a Fortran logical unit number
getc IRIX get a character from a logical unit
putc IRIX write a character to a fortran logical unit
setbuf IRIX assign buffering to a stream logical unit FORTRAN SYNOPSIS #include character *(BUFSIZ+8) buf intege
fseek Tru64 Reposition the file pointer of a stream
fseek IRIX reposition a file pointer in a stream
fsetpos Tru64 Reposition the file pointer of a stream
fseek_unlocked Tru64 Reposition the file pointer of a stream
pxffileno IRIX Returns the file descriptor for a specified unit
fgetpos Tru64 Reposition the file pointer of a stream
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service