/************************************************************************ ** DA_READ * ** * ** This function will read the specified number of bytes from * ** the given file. * ** * ** DA_READ ( IFDES, NBYTE, IOFFST, BUFR, IRET ) * ** * ** Input parameters: * ** IFDES INT* File descriptor * ** NBYTE INT* The number of bytes to read * ** IOFFST INT* The offset in the file * ** * ** Output parameters: * ** BUFR CHAR* Data read from the file * *** * ** Log: * ** J. Chou/EAI 02/93 * ** J. Chou/EAI 07/93 * ************************************************************************/ #include "dacmn.h" void da_read ( ifdes, nbyte, ioffst, bufr, iret ) int *ifdes; int *nbyte; int *ioffst; unsigned char *bufr; int *iret; { int no_byte; int offset; unsigned char **buffer; no_byte = *nbyte; offset = *ioffst; buffer = &bufr; /* ** Move the file pointer to the starting byte of the section. */ lseek ( *ifdes, offset, SEEK_SET ); /* ** Read the data from file to the buffer. Return the ** number of bytes. */ if ( ( *iret = read ( *ifdes, *buffer, no_byte ) ) == no_byte ) *iret = 0; else *iret = -1; }