Hello Mark,
�������, 28 ������� 1999 �., you wrote:
MT> int fskip(FILE *sf,long num_bytes,int dummy)
MT> {
MT> char data[1024];
MT> int i=0,nskip=0,num_to_skip = num_bytes;
MT> while (num_to_skip > 0 ) {
MT> nskip = (num_to_skip>1024) ? 1024 : num_to_skip;
MT> i = fread(data,(size_t)1,(size_t)nskip,sf);
MT> num_to_skip -= nskip;
MT> }
MT> /* return 0 if last read was successful */
MT> return (nskip != i);
MT> }
The very quite good decision. I slightly modified it, so in my opinion
it is more correct.
int fskip(FILE *sf,long num_bytes)
{
char data[1024];
int nskip = 0;
while (num_bytes > 0) {
nskip = (num_bytes>1024) ? 1024 : num_bytes;
num_bytes -= fread(data,(size_t)1,(size_t)nskip,sf);
}
/* return 0 if last read was successful */
return num_bytes;
}
int dummy is not required, as the reading occurs only with current
positions.
My variant with malloc/free was made hastily, only for check of an opportunity
of compilation of the project, and can not apply for the a little correct decision.
As the given function is used very much not frequently, it would be quite possible
to do only fgetc()
PS: sorry my bad english :(
Best regards,
Sergey mailto:[EMAIL PROTECTED]
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )