Page 1 of 1

Problems Adding to a file...

Posted: Mon Nov 04, 2002 3:16 pm
by mindmeddler2002
Ok,
first of all, its been a while...
secound... This never happened before to me....


*In Theory*
I got a file, that is made up of TONS of lines.
All I want to do is add a line to the bottom....

Simple right..

wrong.

I tried a few ways.
I tried just fput it into the file after it was opened...

All it did was replace the whole file with 1 line....
I tried sevaral ways of doing this.
Includeing copying the files contents into a varabile, and then fputing it back.... Figuring since it replaced it.

Nope.

This first way I tried was saving the info, then unlinking it, then remaking it, and saving.

Copy, Deleate, Remake, Past.
Basicly...
When I did this before I had to use that for some reason...

Anyways I get a unlink failure.
When I make it so that there is no unlink failure
(had to move folders and files around, some hidden permisions or something on XP)

IT REPLACES THE FILE AGAIN WITH ONE LINE!!!

I spent 7 hours working on syntax and stuff...
I even tried to download the file to a array, then put it back in...
Just wont work (my code on the last one was a little off I think)

Anyways,
SUGGESTIONS NEEDED PLEASE....

Thanks!

Posted: Mon Nov 04, 2002 3:19 pm
by volka
http://www.php.net/manual/en/function.f ... quote]mode specifies the type of access you require to the stream. It may be any of the following:
...
'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. [/quote]

Did that...

Posted: Mon Nov 04, 2002 7:17 pm
by mindmeddler2002
I did use a and a+
it would either replace the file itself, or give me a array to string conversion error....

got anything better?

Posted: Mon Nov 04, 2002 7:32 pm
by volka
or give me a array to string conversion error....
uh?

Code: Select all

$fd = fopen($filename, 'a') or die("it's all over");
fputs($fd, "appending new string\n");
fclose($fd);
doesn't work?

figured it out

Posted: Mon Nov 04, 2002 8:26 pm
by mindmeddler2002
Ok...

Here was the problem...

Bare with me this is a new one on me...

Apparently when i checked the file, i alwasy tried to edit it.
It was either that and it changed the file permisions....

Or the account, that i was logged in with had its own error that i found later. Apparently when I edited the account, it changed the permissions once again.

Something with XP...
Folders and files i create cant be edited with PHP unless i make it with PHP...

Any suggestions?

Posted: Tue Nov 05, 2002 4:18 am
by volka
set the permissions of the "root" directory according to your needs and enable inheritage of permissions for subdirs

it is

Posted: Tue Nov 05, 2002 6:16 am
by mindmeddler2002
the root is, its when i add a new folder or file that it changes just that file back....

Posted: Tue Nov 05, 2002 6:26 am
by volka
with permission inheritage enabled? How do you create that folder?
I'm running w2k and totally agree with microsoft's own statement if you have w2k there's no need to upgrade to XP
Don't let me be misunderstood. I know many ppl. that are pleased with XP and I wouldn't try to convience them of something else but to me it is eXtreme Problem ;)

Posted: Tue Nov 05, 2002 6:33 am
by volka
ah, and permission granted to webserver/php-account ;)

reason for XP

Posted: Tue Nov 05, 2002 7:07 am
by mindmeddler2002
Well see this computer was originally built to be a server...

aluminum case and powe supply.

Then i found where i use to live, with DSL
they blocked port 80 and 8080 and 88

horrible huh

anyways...
i moved and have cable now (works great and is faster cause i am the only person in my loop, get awsome speeds)

anyways, cause i thought it was not going to be a server, i installed some nice things, like TV tunner (ati all in wonder card) and a creative audigy platnum ex drive (got the best sound)

anyways, and some other special stuff....

2k would suck with this.
i had a labtop and 2k would not reconize the NIC card. A NIC CARD!

anyways... that and it really hated the active matrix display... its not TV not suppose to get horizontal lines cause the attena does not work....

ect ect ect
i have tons of problems....

besides xp comes with a newer IIS

come over to the dark side
volka i am ur father

wait j/k

Posted: Tue Nov 05, 2002 7:22 am
by volka
Never! :D
I suffered too long SuSE-linux's firewall to appreciate ANY preinstalled firewall and I'm under the impression "the more colors the more trouble" ;)
I hate the idea of installing software to prevent my OS from phoning home.

no, serious, I have no need for XP, even my notebook works perfect with w2k. No new OS until INCREDIBLE features I CAN'T live without are available, no new hardware until the current is burned out ;)

lol ok let me finish this

Posted: Tue Nov 05, 2002 7:53 am
by mindmeddler2002
The BEST OS IN HISTORY!

Linux in the Raw!

2nd is Mac OS
belive it or not mac os is kind of like communism.
it has good ideas and intent, just does not work...

then the 3rd is windows 95, the only original copy of windows with a good GUI and no problems....
it was the only stable os windows made. BTW< XP DOES HAVE A BLUE SCREEN OF DEATH.

i saw mac over windows, cause i seen a few versions that actually were inovative... way more than windows....

personally...

my fav OS is IOS v 11.2 in a cisco router...

why?

cause it is simple. and does what it needs to.
mwahaha

Posted: Tue Nov 05, 2002 9:16 am
by DeGauss
What about Lindows?

;D

Posted: Tue Nov 05, 2002 9:30 am
by volka
microsoft's closed-source/license strategy paired with unix's gui comfort/time-to-load. I think I can spare it ;)
(and don't take this post too serious)

lindows

Posted: Tue Nov 05, 2002 12:50 pm
by mindmeddler2002
now all we need is a mac os and novel combo...

macovel OS


...

lindows is a little bit weird. I hear bad things...

its just linux using whine...
but i hear it does not set up right or something