Replacing line in file
I'm fairly new to reading/writing to files so can someone show me how I would delete a line from a file then copy that same line but with additional information on it? Oh and I don't care if it leaves a blank space there.
Here's an example of what I want to do: Original PHP Code:
PHP Code:
Thanks. |
Re: Replacing line in file
heres an sorta of exmaple alter it to ur needs if it works for you unless some one else knows a better why of doing this.
Code:
|
Re: Replacing line in file
I get a runtime error when it tries to write to the file.
Code:
[AMXX] Run time error 10: native error (native "write_file")Code:
write_file(filename, readdata, line - 1)Code:
|
Re: Replacing line in file
do you have this or somin like this??
Code:
|
Re: Replacing line in file
Quote:
Something similar. I have this. Code:
|
Re: Replacing line in file
I had this problem with one of my plugins before, but i forget excalty what it was. Can you paste your whole code, maybe it will refresh my memory. First though make sure you actually have a file called "list" in your configs folder.
you can also add this in your code if u dont have it: Code:
new filename[256] |
Re: Replacing line in file
I chopped off some stuff but this is basically it. Oh btw I do have a file called "list". I use the "write" command and it'll make it for me.
Code:
see bottem for more recent version |
Re: Replacing line in file
take out this part of your code in plugin_int;
Code:
|
Re: Replacing line in file
Oh I know, I want it to delete the file after every map load. Since I know it's doing that, everytime I test I always use the "write" command before the "replace" command.
|
Re: Replacing line in file
I had a problem were if there was something extra that was not used it created an error for my write_file and read_file i dont know why so check that. Any way i dont see a problem with your code but i could be wrong. im tired and a lil toasted so im out, ill look over it again tomor unless someone else ssoleves it.
|
| All times are GMT -4. The time now is 10:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.