Raised This Month: $ Target: $400
 0% 

Replacing line in file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
djmd378
Senior Member
Join Date: Sep 2004
Old 05-12-2007 , 21:13   Replacing line in file
Reply With Quote #1

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:
Line1 1
Line2 1
Line3 1 
New
PHP Code:
Line1 1
Line2 11
Line3 1 
I know I can do this by copying everything except the line I don't want into a new file then deleting the original and renaming the new file to the original. But the problem I had with this is that once I write additional information into it, the server crashes. So this is why I don't care for blank lines. =]

Thanks.
__________________
djmd378 is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode