Skip to main content
`Ctrl`+`K`

# 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 processes that have the file. If MPI rank 0 does not have the file it generates an error even if another MPI process does have the file.

## See Also

Viewers: Looking at PETSc Objects, `PETSCVIEWERBINARY`, `PetscViewerBinaryOpen()`, `PetscViewerBinaryGetInfoPointer()`

## Level

advanced

## Location

src/sys/classes/viewer/impls/binary/binv.c

## Examples

src/vec/vec/tutorials/ex6.c
src/vec/vec/tutorials/ex6f.F90

Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages