Krzysztof Kolago wrote:
>
> Hello!
>
> I wrote program that should read binary file, but it read only a part of
> it (13690 of 64KB). Maybe somebody can help me, and will tell me, how to
> modificate program source. I need to read all bytes of the file!
>
Then read them!
read() may read fewer bytes then requested. But that's not a problem,
read() tells you how much could be read in one rush. Just subtract
what read() has already read from twhat was requested and do another
read() until you have read everything (read() returns 0 if end of file
was reached or -1 if there was an error)
ToRead = some_number;
while( ( HaveRead = read( Plik, bufor, ToRead ) ) > 0 ) {
// do something with the read bytes.
ToRead -= some_number;
}
if( HaveRead == -1 )
printf( "There was an error during read\n" );
--
Karl Heinz Buchegger