Raised This Month: $ Target: $400
 0% 

how do i delete a line from a file? [solved]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 03-10-2009 , 16:02   Re: how do i delete a line from a file?
Reply With Quote #3

Well using exolent method I do this. PS: I dont test

PHP Code:
stock remove_x_line(const file[], line)
{
    new 
extencion[8], realfile[128], tempfile[128], lencontador
    copy
(realfile127file)
    
copy(tempfile127file)
    
len strlen(tempfile)
    
copy(extencion7tempfile[len-4])
    
tempfile[len-4] = '^0'
    
formatex(tempfile127"%s_temp%s"tempfileextencion)
    
    new 
file fopen(tempfile"wt")
    new 
vault fopen(realfile"rt")
    
    new 
data[128]
    
    while( !
feof(vault) )
    {
        
contador++
        
fgets(vaultdata127)
        
        if( 
contador == line ) continue
        
        
fputs(filedata)
    }
    
    
fclose(file)
    
fclose(vault)
    
    
delete_file(realfile)
    while( !
rename_file(tempfilerealfile1) ) { }

Well i dont remove, but exolent ansers first. Sorry xD
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
 



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 09:02.


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