# PetscViewerFileGetMode
Gets the open mode of file 
## 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
```
```none
FILE_MODE_READ - open existing file for binary input
```
```none
FILE_MODE_APPEND - open existing file for binary output
```




## See Also
 `PetscViewerFileSetMode()`, `PetscViewerCreate()`, `PetscViewerSetType()`, `PetscViewerBinaryOpen()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/binary/binv.c.html#PetscViewerFileGetMode">src/sys/classes/viewer/impls/binary/binv.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexexodusii.c.html#PetscViewerFileGetMode_ExodusII">PetscViewerFileGetMode_ExodusII in src/dm/impls/plex/plexexodusii.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/ascii/filev.c.html#PetscViewerFileGetMode_ASCII">PetscViewerFileGetMode_ASCII in src/sys/classes/viewer/impls/ascii/filev.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/binary/binv.c.html#PetscViewerFileGetMode_Binary">PetscViewerFileGetMode_Binary in src/sys/classes/viewer/impls/binary/binv.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/cgns/cgnsv.c.html#PetscViewerFileGetMode_CGNS">PetscViewerFileGetMode_CGNS in src/sys/classes/viewer/impls/cgns/cgnsv.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/hdf5/hdf5v.c.html#PetscViewerFileGetMode_HDF5">PetscViewerFileGetMode_HDF5 in src/sys/classes/viewer/impls/hdf5/hdf5v.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/vtk/vtkv.c.html#PetscViewerFileGetMode_VTK">PetscViewerFileGetMode_VTK in src/sys/classes/viewer/impls/vtk/vtkv.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/vu/petscvu.c.html#PetscViewerFileGetMode_VU">PetscViewerFileGetMode_VU in src/sys/classes/viewer/impls/vu/petscvu.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
