# PetscViewerBinaryGetDescriptor
Extracts the file descriptor from a `PetscViewer` of `PetscViewerType` `PETSCVIEWERBINARY`. 
## Synopsis
```
#include "petscviewer.h"   
PetscErrorCode PetscViewerBinaryGetDescriptor(PetscViewer viewer, int *fdes)
```
Collective because it may trigger a `PetscViewerSetUp()` call; No Fortran Support


## Input Parameter

- ***viewer -*** `PetscViewer` context, obtained from `PetscViewerBinaryOpen()`



## Output Parameter

- ***fdes -*** file descriptor





## Note
For writable binary `PetscViewer`s, the descriptor will only be valid for the
first processor in the communicator that shares the `PetscViewer`. For readable
files it will only be valid on nodes that have the file. If node 0 does not
have the file it generates an error even if another node does have the file.


## See Also
 [](sec_viewers), `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`

## Level
advanced

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

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/tutorials/ex6.c.html">src/vec/vec/tutorials/ex6.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/vec/tutorials/ex6f.F90.html">src/vec/vec/tutorials/ex6f.F90.html</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)  
