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
Owyn
Veteran Member
Join Date: Nov 2007
Old 03-10-2009 , 16:29   Re: how do i delete a line from a file?
Reply With Quote #6

i tried to modyfy that stock but on execution it killed my test server =3

Code:
stock unregname(const arg2[])
{
    new extencion[8], realfile[128], tempfile[128], len
    new arg11[32], arg12[32]
    copy(realfile, 127, g_steam_file)
    copy(tempfile, 127, g_steam_file)
    len = strlen(tempfile)
    copy(extencion, 7, tempfile[len-4])
    tempfile[len-4] = '^0'
    formatex(tempfile, 127, "%s_temp%s", tempfile, extencion)
    
    new file = fopen(tempfile, "wt")
    new vault = fopen(realfile, "rt")
    
    new data[128]
    
    while( !feof(vault) )
    {
        fgets(file, data, 63);
        
        parse(data, arg11, 31, arg12, 31);
        
        if( arg12[31] == arg2[31] ) continue
        
        fputs(file, data)
    }
    
    fclose(file)
    fclose(vault)
    
    delete_file(realfile)
    while( !rename_file(tempfile, realfile, 1) ) { }
}

Last edited by Owyn; 03-10-2009 at 16:42.
Owyn is offline
Send a message via ICQ to Owyn
 



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