# 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
- ***num      -*** Number of items of data to read
- ***datatype -*** Type of data to read



## Output Parameters

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



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




## See Also
 [](sec_viewers), `PetscViewer`, `PetscViewerASCIIOpen()`, `PetscViewerPushFormat()`, `PetscViewerDestroy()`,
`VecView()`, `MatView()`, `VecLoad()`, `MatLoad()`, `PetscViewerBinaryGetDescriptor()`,
`PetscViewerBinaryGetInfoPointer()`, `PetscFileMode`, `PetscViewer`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/interface/view.c.html#PetscViewerRead">src/sys/classes/viewer/interface/view.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/interface/view.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)  
