---
name: "rfio_popen"
section: "3"
platform: "linux"
package: "libdpm-dev"
version: "1.10.0-2+b3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/rfio_popen"
---

# rfio\_popen(3)

start a process and open a pipe to it

## 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

- **ENOMEM**

  Not enough memory.

- **EINVAL**

  The mode provided is invalid.

- **ECONNRESET**

  Connection reset by peer

- **ETIMEDOUT**

  Connection timed out

- **ECONNREFUSED**

  Connection refused

- **EHOSTUNREACH**

  No route to host

- **SENOSHOST**

  Host unknown.

- **SENOSSERV**

  Service unknown.

- **SEUMSG2LONG**

  Command string too long.

- **SECOMERR**

  Communication error.

## SEE ALSO

**[rfio\_pread(3)](/rfio_pread/3.md)**, **[rfio\_pwrite(3)](/rfio_pwrite/3.md)**

## AUTHOR

**LCG Grid Deployment** Team
