Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
xt_ff_popen(3)		    Library Functions Manual		  xt_ff_popen(3)

NAME
     xt_ff_popen() - Create a fast file stream connected to a process

LIBRARY
     #include <xtend/fast-file.h>
     -lxtend

SYNOPSIS
     xt_ff_t *xt_ff_popen(const char *cmd, int flags)

ARGUMENTS
     cmd     Full command to execute as the child, passed to sh(1)
     flags   Open mode flags passed to open(3)

DESCRIPTION
     xt_ff_popen(3)  creates  a  pipe  for  interprocess communication, runs the
     specified command, connecting the command's standard input or standard out-
     put to the pipe, and returning a pointer to a xt_ff_t object  connected  to
     the other end.

     It  behaves  much like popen(3), except that it returns a fast-file xt_ff_t
     pointer rather than a standard I/O FILE pointer, and accepts a full set  of
     open(3) flags rather than the fopen(3) type strings "r", "w", etc.

     This allows the calling program to spawn a child process and read its stan-
     dard  output or write to its standard input as easily as reading or writing
     a file.

     Note that the stream may be closed with xt_ff_close(3).   Unlike  popen(3),
     which   must   be	used  with  pclose(3),	it  is	not  necessary	to  call
     _xt_ff_pclose(3) directly.  The xt_ff_close(3) function  automatically  de-
     termines whether the stream is attached to a pipe.

     The xt_ff_t system is simpler than and much faster than traditional FILE on
     typical  systems.	 It is intended for processing large files character-by-
     character, where low-level block I/O is not convenient, but FILE I/O causes
     a bottleneck.

RETURN VALUES
     Pointer to a xt_ff_ile_t object on success, NULL otherwise

EXAMPLES
     xt_ff_t *instream;

     if ( (instream = xt_ff_popen("xzcat file.xz", O_RDONLY)) == NULL )
     {
	 fprintf(stderr, "Failed to read xzcat file.xz.n");
	 exit(EX_NOINPUT);
     }

     xt_ff_close(instream);

SEE ALSO
     xt_ff_open(3), xt_ff_close(3), popen(3), open(3)

								  xt_ff_popen(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=xt_ff_popen&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help