Add character in existing line
I'm trying to add a character in front of an existing string, and then replace the old line inside the file with the new edited one.
For example: Current: PHP Code:
PHP Code:
|
Re: Add character in existing line
It's not very hard:
1.Create a temporary file. 2.Open the original file and read line by line. 3.Write all lines from the original file to the temporary file exactly how they are, except the desired line, which you edit and then write. 4.Delete the original file. 5.Rename the temporary file to the original name. |
Re: Add character in existing line
Quote:
|
Re: Add character in existing line
Quote:
|
Re: Add character in existing line
Quote:
|
Re: Add character in existing line
Quote:
|
Re: Add character in existing line
Quote:
|
Re: Add character in existing line
There's a problem though, even with that stock, how am I supposed to add a character at the start of the text? If I replace " with ;" it will be like this
PHP Code:
PHP Code:
|
Re: Add character in existing line
Quote:
1.Shift all cell's content one position to the right and then overwrite the first one. 2.Use formatex in another string, like formatex(..., ..., ";%s", Line). 3.Use strcat. |
Re: Add character in existing line
Quote:
Is NewLine[] purposely not used or you just forgot? PHP Code:
|
All times are GMT -4. The time now is 14:18. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.