Hi, I've recently started coding and have a small question... Is it possible to pass a $fp (file pointer) into a function? (and how). The thing is that one of the block of data that has to be decoded has a length indicator on the 3rd byte of data within each byte... and I wrote the follwing function to extract the length :
function getLength($fp) {
fread ( $fp, 2);
$this->int_recordLength .= bindec(fread($fp, 1));
switch ($int_recordLength) {
case '16': $arr_fields['4']['bytes'] = '16';
break;
case '19':
$arr_fields['4']['bytes'] = '19';
break;
case '':
echo 'the file pointer was empty';
default:
break;};
return $this->arr_fields['4']['bytes'];
return $this->int_recordLength;
}
Now. Is it possible to pass $fp to a funtion to use as input, and how?
Any ideas? If you need more info, please shout... please see file attached! All code and the test file is contained within...
Regards,
/Arno