Jump to content

problem with fseek() and ftell()


sheraz

Recommended Posts

hi sir i m working with fseek() and ftell().

 

i don't know what is the problem.i have just moved the position indicator 4 steps ahead and write the data on file. the code is correctly writing in the file but it is not displaying when i try to display it.

 

here the code is..

 

reading the data from file.

 

 

<?php

if(! $fp=fopen("abc.txt", "w"))

 

die("could not find the required file");

else

{

fseek($fp,4);

fwrite($fp,"welcome to php programming");

}

 

$file=fopen("abc.txt", "r");

$fi=ftell($file);

fseek($file,$fi);

echo fread($file,20);

?>

 

 

it does not display anything. but data has been written on the file.

please help me. :'(

Link to comment
https://forums.phpfreaks.com/topic/173406-problem-with-fseek-and-ftell/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.