# PetscBinarySynchronizedRead

Reads from a binary file.

### Synopsis

    #include "petscsys.h"
    PetscErrorCode  PetscBinarySynchronizedRead(MPI_Comm comm,int fd,void *p,PetscInt n,PetscDataType type)

Collective on MPI_Comm

### Input Parameters

| comm | - the MPI communicator
| fd | - the file
| n | - the number of items to read
| type | - the type of items to read (PETSC_INT, PETSC_DOUBLE or PETSC_SCALAR)

### Output Parameters

p -the buffer

### Options Database Key

-binary_longints -indicates the file was generated on a Cray vector machine (not the T3E/D) and the ints are stored as 64 bit quantities, otherwise they are stored as 32 bit

### Notes

Does a PetscBinaryRead() followed by an MPI_Bcast()

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()

Level:developer
Location: src/sys/fileio/sysio.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages