Re: Moving the pointer in a file...
| From: | Kondwani Spike Mkandawire | Date: | Fri, 12 Jul 2002 18:05:52 +0000 |
| Subject: | Re: Moving the pointer in a file... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107408@lists.php.net to get a copy of this message | ||
Figured it out:
I just rewrote the first 3 lines with a few new Line Characters and place
respat the
Line I wanted Changed with its Variable...
fputs($file, "<?\nline1\nline2....etc");
The reason I was trying to read it at first was that I had a Cookie Set at
the very
top and I thought it would reset this each time it rewrites it... Since my
code is
running on Sessions that doesn't really matter... However just for
Interests Sake...
Given that I was not using sessions, and I wanted the Cookie Maintained,
would
rewriting it to self file on each try, reset the cookie hence elongating the
Cookie
expiration Time?
Spike...
"Kondwani Spike Mkandawire" <kondwani@cs.mun.ca> wrote in message
news:20020712152856.25591.qmail@pb1.pair.com...
> I am trying to read and write to a file on Line 5 and line 5 alone...
> $file = fopen($fileName, "r+");
> Places the pointer at the beginning of the file I have tried the
> following...
>
> $line = fgets($file, 255);
> $line = fgets($file, 255);
> $line = fgets($file, 255);
> $line = fgets($file, 255);
> fputs($file, "the Line I want to write;");
> but nothing is happening... Please Help...
>
> Kondwani
>
>