Raised This Month: $ Target: $400
 0% 

How to add a ; before a line in a file...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-28-2007 , 16:53   How to add a ; before a line in a file...
Reply With Quote #1

Anybody care to share the best method?
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 05-28-2007 , 17:12   Re: How to add a ; before a line in a file...
Reply With Quote #2

Open the file in your choice of text editor and press the ; key while the cursor is placed at the beginning of the line.

Last edited by Lee; 05-28-2007 at 18:52.
Lee is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 05-28-2007 , 17:17   Re: How to add a ; before a line in a file...
Reply With Quote #3

LOL. Best. Scripting Help. Ever
_Master_ is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 05-28-2007 , 18:03   Re: How to add a ; before a line in a file...
Reply With Quote #4

Read the line in, use either format() or add(), then write the line back out.
__________________
Brad is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-28-2007 , 19:35   Re: How to add a ; before a line in a file...
Reply With Quote #5

Something like this?

PHP Code:
copy(copied_line,511,text)
format(copied_line,511,";")
replace(text511textcopied_line)
write_file(filetextline 1
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
pRED*
Join Date: Dec 2006
Old 05-28-2007 , 19:43   Re: How to add a ; before a line in a file...
Reply With Quote #6

how about just

Code:
format(line,511,";%s",line)
pRED* is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 05-28-2007 , 19:43   Re: How to add a ; before a line in a file...
Reply With Quote #7

PHP Code:
read_file(fileline_notext[1], 510len)
text[0] = ';'
write_file(filetextline_no 1
_Master_ is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 05-28-2007 , 20:08   Re: How to add a ; before a line in a file...
Reply With Quote #8

Quote:
Originally Posted by pRED* | NZ View Post
how about just

Code:
format(line,511,";%s",line)
Thanks.
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 05-28-2007 , 22:03   Re: How to add a ; before a line in a file...
Reply With Quote #9

Quote:
Originally Posted by SweatyBanana View Post
Thanks.
I foresee very good use of this to disable a plugin permanently just by pausing it once then adding a semi-colon in front of that specific plugin filename, but hey, that's just me :-).

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
Reply



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:41.


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