PETSc version 3.16.5
Fix/Edit manual page

# PetscFOpen

Has the first process in the communicator open a file; all others do nothing.

### Synopsis

    PetscErrorCode  PetscFOpen(MPI_Comm comm,const char name[],const char mode[],FILE **fp)

Logically Collective

### Input Parameters

| comm | - the communicator
| name | - the filename
| mode | - the mode for fopen(), usually "w"

### Output Parameter

| fp | - the file pointer

### Notes

NULL (0), "stderr" or "stdout" may be passed in as the filename

### Fortran Note

This routine is not supported in Fortran.

### See Also

PetscFClose(), PetscSynchronizedFGets(), PetscSynchronizedPrintf(), PetscSynchronizedFlush(),
PetscFPrintf()

### Level

developer

### Location

src/sys/fileio/mpiuopen.c

### Examples

src/sys/classes/random/tutorials/ex2.c.html
src/ksp/ksp/tutorials/ex43.c.html
src/ksp/ksp/tutorials/ex49.c.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages