Moving Around a File with fseek() : File Seek : File Directory PHP Source Code


PHP Source Code » File Directory » File Seek »

 

Moving Around a File with fseek()




<html>
<head>
<title>Moving around a file with fseek()</title>
</head>
<body>
<?php
    $filename = "test.txt";
    $fp = fopen$filename, "r" or die("Couldn't open $filename");

    $fsize = filesize($filename);
    $halfway = (int)( $fsize / );

    print "Halfway point: $halfway <BR>n";
    fseek$fp, $halfway );

    $chunk = fread$fp, ($fsize - $halfway) );
    print $chunk;
?>
</body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo File Directory
» File Seek