alin19 Posted June 11, 2008 Share Posted June 11, 2008 i have a file and i want to read from it from byte 1024 for example, and from each line i want only to read 8 bytes, i have this code, can you help me? $handle = fopen("C:\Documents and Settings\Administrator\Desktop\sibiu\FuturesDeal.txt", "r"); if ($handle) { while (!feof($handle)) { $buffer = fgets($handle,; echo $buffer; echo ftell($handle); } fclose($handle); } , Quote Link to comment Share on other sites More sharing options...
Vizor Posted June 11, 2008 Share Posted June 11, 2008 This would read every 8 bytes from 1024 bytes into the file. <?php $fp = fopen('file.txt', "r"); $offset = 1024; while(!feof($fp)) { echo fgets($fp, $offset); $offset += 8; } fclose($fp); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.