:orphan:
# PetscFOpen
Has the first process in the MPI communicator open a file; all others do nothing.
## Synopsis
```
PetscErrorCode PetscFOpen(MPI_Comm comm, const char name[], const char mode[], FILE **fp)
```
Logically Collective; No Fortran Support
## Input Parameters
- ***comm -*** the MPI communicator
- ***name -*** the filename
- ***mode -*** the mode for `fopen()`, usually "w"
## Output Parameter
- ***fp -*** the file pointer
## Note
`NULL`, "stderr" or "stdout" may be passed in as the filename
## See Also
`PetscFClose()`, `PetscSynchronizedFGets()`, `PetscSynchronizedPrintf()`, `PetscSynchronizedFlush()`,
`PetscFPrintf()`
## Level
developer
## Location
src/sys/fileio/mpiuopen.c
## Examples
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex49.c
src/sys/classes/random/tutorials/ex2.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/fileio/mpiuopen.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)