#include <fcntl.h> /* Needed only for _O_RDWR definition */
#include <io.h>
#include <stdlib.h>
#include <stdio.h>
#include <share.h>
char buffer[60000];
int main( void )
{
int fh;
unsigned int nbytes = 60000, bytesread;
/* Open file for input: */
fh = fh1 = _open( "file.bin", _O_RDONLY | _O_BINARY);
if( !fh )
{
perror( "open failed on input file" );
exit( 1 );
}
/* Read in input: */
if( ( bytesread = _read( fh, buffer, nbytes ) ) <= 0 )
perror( "Problem reading file" );
else
printf( "Read %u bytes from file\n", bytesread );
_close( fh );
} |