# PetscBinarySynchronizedRead
Reads from a binary file. 
## Synopsis
```
PetscErrorCode PetscBinarySynchronizedRead(MPI_Comm comm, int fd, void *data, PetscInt num, PetscInt *count, PetscDataType type)
```
Collective


## Input Parameters

- ***comm -*** the MPI communicator
- ***fd -*** the file descriptor
- ***num  -*** the maximum number of items to read
- ***type -*** the type of items to read (`PETSC_INT`, `PETSC_REAL`, `PETSC_SCALAR`, etc.)



## Output Parameters

- ***data -*** the buffer
- ***count -*** the number of items read, optional





## Notes
Does a `PetscBinaryRead()` followed by an `MPI_Bcast()`

If count is not provided and the number of items read is less than
the maximum number of items to read, then this routine errors.

`PetscBinarySynchronizedRead()` uses byte swapping to work on all machines.
Integers are stored on the file as 32 long, regardless of whether
they are stored in the machine as 32 or 64, this means the same
binary file may be read on any machine.


## See Also
 `PetscBinaryWrite()`, `PetscBinaryOpen()`, `PetscBinaryClose()`, `PetscBinaryRead()`, `PetscBinarySynchronizedWrite()`,
`PetscBinarySynchronizedSeek()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/fileio/sysio.c.html#PetscBinarySynchronizedRead">src/sys/fileio/sysio.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/fileio/sysio.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
