I've got this text file that I'm supposed to read.
The elements in the file are separated only by bytes. For example one element may reside at starting point 146 bytes and end at point 211 bytes.
I have all the byte references in an array so all that I'm missing is a function to do the actual reading.
The array contains all the byte references from 0 to eof and I want to read the entire file.
Can anyone give me some tips or example code on how to do this?
Reading a text file using byte offsets
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
we're not going to do your homework for you.. but here's a hint:
Code: Select all
<?php
for($x = 0, $y = strlen($file_contents); $x < $y; $x++)
{
$current_byte = $file_contents{$x};
}
?>