Skip to main content
`Ctrl`+`K`

# PetscViewerRead

Reads data from a `PetscViewer`

## Synopsis

    #include "petscviewer.h"
    PetscErrorCode PetscViewerRead(PetscViewer viewer, void *data, PetscInt num, PetscInt *count, PetscDataType dtype)

Collective

## Input Parameters

- viewer - The viewer

- data - Location to write the data, treated as an array of the type defined by `datatype`

- num - Number of items of data to read

- dtype - Type of data to read

## Output Parameter

- count - number of items of data actually read, or `NULL`

## Notes

If datatype is `PETSC_STRING` and `num` is negative, reads until a newline character is found, until a maximum of (-num - 1) chars.

Only certain viewers, such as `PETSCVIEWERBINARY` can be read from, see `PetscViewerReadable()`

## See Also

Viewers: Looking at PETSc Objects, `PetscViewer`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`, `PetscViewerReadable()`, `PetscViewerBinaryGetDescriptor()`, `PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`

## Level

beginner

## Location

src/sys/classes/viewer/interface/view.c

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