GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
xt_ff_popen(3) FreeBSD Library Functions Manual xt_ff_popen(3)

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

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

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

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

xt_ff_popen(3) creates a pipe for interprocess communication, runs the specified command, connecting the command's standard input or standard output 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 standard 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 determines 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.

Pointer to a xt_ff_ile_t object on success, NULL otherwise

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);

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


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.