Scroll to navigation

RFIO_POPEN(3) Rfio Library Functions RFIO_POPEN(3)

NAME

rfio_popen, rfio_pclose - start a process and open a pipe to it

SYNOPSIS

#include <sys/types.h>
#include "rfio_api.h"

FILE *rfio_popen (const char *command, const char *type);

int rfio_pclose (FILE *fs);

DESCRIPTION

rfio_popen starts a process and opens a pipe to it.

command is a pointer to a string specifying the shell command to be executed.

type is a mode indicator for the pipe. One of the characters "r" or "w".

rfio_pclose waits for the forked process to terminate and returns the exit status of the command.

EXAMPLE

	int c;
	FILE *rf;
	rf = rfio_popen (command, "r");
	if (rf == NULL) {
		rfio_perror ("rfio_popen");
		exit (1);
	}
	while ((c = rfio_pread (buf, 1, sizeof(buf), rf)) > 0) {
		...
	}
	c = rfio_pclose (rf);

RETURN VALUE

This routine returns NULL if the operation failed or a non-NULL pointer to a FILE structure if the operation was successful. If it fails, serrno variable is set appropriately.

ERRORS

Not enough memory.
The mode provided is invalid.
Connection reset by peer
Connection timed out
Connection refused
No route to host
Host unknown.
Service unknown.
Command string too long.
Communication error.

SEE ALSO

rfio_pread(3), rfio_pwrite(3)

AUTHOR

LCG Grid Deployment Team

$Date: 2008/09/24 11:25:01 $ LCG