# PetscPOpen

Runs a program on processor zero and sends either its input or output to a file.

### Synopsis

    PetscErrorCode PETSC_DLLEXPORT PetscPOpen(MPI_Comm comm,const char machine[],const char program[],const char mode[],FILE **fp)

Collective on MPI_Comm, but only process 0 runs the command

### Input Parameters

| comm | - MPI communicator, only processor zero runs the program
| machine | - machine to run command on or PETSC_NULL, or string with 0 in first location
| program | - name of program to run
| mode | - either r or w

### Output Parameter

fp -the file pointer where program input or output may be read or PETSC_NULL if don't care

### Notes

Use PetscPClose() to close the file pointer when you are finished with it Does not work under Windows

The program string may contain ${DISPLAY}, ${HOMEDIRECTORY} or ${WORKINGDIRECTORY}; these will be replaced with relevent values.

### See Also

PetscFOpen(), PetscFClose(), PetscPClose()

Level:intermediate
Location: src/sys/fileio/mpiuopen.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages