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
ffpopen(3) FreeBSD Library Functions Manual ffpopen(3)

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

ffile_t *ffpopen(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)

ffpopen(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 ffile_t object connected to the other end.

It behaves much like popen(3), except that it returns a fast-file fffile_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.

The stream should be closed with ffpclose(3) rather than ffclose(3) in order to wait for the child process to complete and return its exit status.

The ffile_t system is simpler than and several times as fast as 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 ffile_t object on success, NULL otherwise

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

ffopen(3), ffpclose(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.