:orphan:
# PetscViewerFileGetMode
Gets the open mode of a file associated with a `PetscViewer`
## Synopsis
```
#include "petscviewer.h"
PetscErrorCode PetscViewerFileGetMode(PetscViewer viewer, PetscFileMode *mode)
```
Not Collective
## Input Parameter
- ***viewer -*** the `PetscViewer`; must be a `PETSCVIEWERBINARY`, `PETSCVIEWERMATLAB`, `PETSCVIEWERHDF5`, or `PETSCVIEWERASCII` `PetscViewer`
## Output Parameter
- ***mode -*** open mode of file
```none
FILE_MODE_WRITE - create new file for binary output
FILE_MODE_READ - open existing file for binary input
FILE_MODE_APPEND - open existing file for binary output
```
## See Also
[](sec_viewers), `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()`
## Level
advanced
## Location
src/sys/classes/viewer/impls/binary/binv.c
## Implementations
PetscViewerFileGetMode_ExodusII in src/dm/impls/plex/plexexodusii.c
PetscViewerFileGetMode_ASCII in src/sys/classes/viewer/impls/ascii/filev.c
PetscViewerFileGetMode_Binary in src/sys/classes/viewer/impls/binary/binv.c
PetscViewerFileGetMode_CGNS in src/sys/classes/viewer/impls/cgns/cgnsv.c
PetscViewerFileGetMode_HDF5 in src/sys/classes/viewer/impls/hdf5/hdf5v.c
PetscViewerFileGetMode_VTK in src/sys/classes/viewer/impls/vtk/vtkv.c
PetscViewerFileGetMode_VU in src/sys/classes/viewer/impls/vu/petscvu.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/binary/binv.c)
[Index of all Viewer routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)