Read Tell functions

O

orion30

I used the read function in order to read a big file.
I read the file by 1024 blocks in a WHILE statement.

During the read statement there is a problem.
Indeed, the read function return 1023 and
the difference before and after the call of this function
if I used tell function is 1024.

Apparently the seek is 1024 but the read is 1023
(it's not the end of the file at this step)

My code is something like

While ...
tell(...
read(...
tell(...

Some ideas ?

Best regards
 
J

Jos A. Horsmeier

orion30 said:
I used the read function in order to read a big file.
I read the file by 1024 blocks in a WHILE statement.

During the read statement there is a problem.
Indeed, the read function return 1023 and
the difference before and after the call of this function
if I used tell function is 1024.

Apparently the seek is 1024 but the read is 1023
(it's not the end of the file at this step)

My code is something like

While ...
tell(...
read(...
tell(...

Some ideas ?

Without seeing some actual code, I can only guess ...
did you fopen the file using "r" mode instead of "rb"?
Are you sure you're passing 1024 as the actual number
of bytes to be read? Can you show some actual code?

kind regards,

Jos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top