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

  man pages->IRIX man pages -> f90/ffseek (3)              
Title
Content
Arch
Section
 

Contents


FFSEEK(3C)					      Last changed: 2-18-98

NAME    [Toc]    [Back]

     ffseek, ffbksp, ffseekf, ffbkspf -	Repositions a flexible file I/O
     file

SYNOPSIS    [Toc]    [Back]

     #include <ffio.h>

     #include <unistd.h>

     UNICOS and	UNICOS/mk systems:

	int ffseek (int	fd, off_t pos, int whence [, struct ffsw *stat]);

	int ffbksp (int	fd [, struct ffsw *stat]);

     IRIX systems:

	off_t ffseek (int fd, off_t pos, int whence);

	int ffbksp (int	fd);

     All systems:

	off_t ffseekf (int fd, off_t pos, int whence,  struct ffsw *stat);

	int ffbkspf (int fd, struct ffsw *stat);

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

DESCRIPTION    [Toc]    [Back]

     The ffseek	function provides flexible file	I/O (FFIO) positioning
     capability	similar	to that	of lseek(2).  In addition to the
     functionality of lseek, ffseek provides access to limited positioning
     on	blocked	files and record-oriented files.  Specifying ffseek(fd,	0,
     0)	always rewinds a file to its initial point, regardless of whether
     the file is stream, blocked, or tape.  When using the syscall layer,
     this function cannot be used to position a	tape.

     This function allows programs to be written so that their I/O can be
     controlled	by the asgcmd(1) or assign(1) command.	Both native and
     foreign record-oriented I/O, multifile datasets, and
     performance-oriented layers (such as SDS resident layers and
     memory-resident layers) are available with	this mechanism.

     Function ffbksp allows you	to perform a backspace operation on those
     FFIO layers that support it.  Currently, this is limited to cos, tape,
     f77, and text.

     Arguments are as follows:

     fd	      Number returned by ffopen(3C).

     pos      Byte position requested.

     whence   Specifies	one of the following values (defined in	header file
	      stdio.h):

	      0	or SEEK_SET	  Sets the pointer to the value	of pos.
				  pos must be a	non-negative integer.
				  (Special case:  ffseek(fd, 0,	0) =
				  rewind)

	      1	or SEEK_CUR	  Sets the pointer to the current position,
				  plus or minus	*arg.  This is supported
				  only in layers that are not
				  record-oriented; layers are specified	to
				  assign -F as follows:	 syscall, sds, mr
				  (memory resident), cache, cachea, bufa,
				  er90.

	      2	or SEEK_END	  Sets the pointer to the end of the file,
				  minus	pos.  pos must be a non-negative
				  integer.  Not	all layers support this
				  option.  (Special case: ffseek(fd, 0,	2)
				  = position just in front of the EOD.)

     stat     Pointer to the ffsw status return	structure.

RETURN VALUES    [Toc]    [Back]

     The return	value is the current position in the file after	the seek.
     Upon successful completion, a non-negative	value is returned.
     Otherwise,	-1 is returned,	and, if	the stat parameter is passed, the
     error value is found in stat.sw_error.  If	the stat parameter is not
     provided, the error code is found in errno.

EXAMPLES    [Toc]    [Back]

	  #include <stdlib.h>
	  #include <fcntl.h>
	  #include <stdio.h>
	  #include <ffio.h>

	  main()
	  {
	       size_t ret;
	       int fd, i, j;
	       off_t fret;

	       fd = ffopen("data", O_RDWR | O_CREAT, 0666);

	       for (i =	0 ; i <	1000 ; i++)
	       {
		    ret	= ffwrite(fd, &i, sizeof(i));
		    if (ret < 0) abort();
	       }

	       for (i =	0 ; i <	10 ; i++)
	       {
		    fret = ffseek(fd, i	* sizeof(j) * 100, SEEK_SET);
		    if (fret < 0) abort();
		    ret	= ffread(fd, &j, sizeof(j));
		    if (ret < 0) abort();
		    printf("Value is %d	at word	%d\n", j, i*100);
	       }
	  }

     Output from the previous program is as follows:

	  Value	is 0 at	word 0
	  Value	is 100 at word 100
	  Value	is 200 at word 200
	  Value	is 300 at word 300
	  Value	is 400 at word 400
	  Value	is 500 at word 500
	  Value	is 600 at word 600
	  Value	is 700 at word 700
	  Value	is 800 at word 800
	  Value	is 900 at word 900

SEE ALSO    [Toc]    [Back]

      
      
     errno.h(3C), ffclose(3C), ffopen(3C), ffread(3C), ffwrite(3C)

     Application Programmer's Library Reference	Manual,	publication
     SR-2165, for the printed version of this man page.
[ Back ]
 Similar pages
Name OS Title
ffopen IRIX Opens or closes a file using flexible file I/O
ffread IRIX Provides flexible file I/O
ffpos IRIX Positions files opened using flexible file I/O
fffcntl IRIX Performs functions on files opened using flexible file I/O
AFclosefile IRIX close an audio file, update file header if file was opened for write access.
fdetach Tru64 Detach a STREAMS-based file descriptor from a file in the file system name space
fattach Tru64 Attach a STREAMS-based file descriptor to a file in the file system name space
floppy HP-UX direct flexible or ``floppy'' disk access
migrate Tru64 Move a file or file pages to another volume in an AdvFS file domain
ffm Tru64 File-on-File Mounting File System
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service