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
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.