Raised This Month: $ Target: $400
 0% 

Solved Remove line from file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 02-10-2022 , 13:11   Remove line from file
Reply With Quote #1

Hello alliedmoders ,
As what i typed in the title, iam try to remove line from the file.
I created a vip system and i want to add option for remove who has date expired and i have searched for how to do that and found some ways and i used one that recommend by HamletEagle but i got an issue and don't know how to fix it

PHP Code:
RemoveExpired( const szIdentity[ ] )
{
    new const 
szTempFileName[ ] = "tempfile.ini";

    new 
szFormat128 ], szData192 ], szIdentity2MAX_NAME_LENGTH ];
    
    new 
szTempFilePath64 ];
    
formatexszTempFilePathcharsmaxszTempFilePath ), "%s/%s"g_szConfigsszTempFileName );
    
formatexszFormatcharsmaxszFormat ), "%s/%s"g_szConfigsg_iAccountFile );
    
    new 
iFilePointer fopenszFormat"rt" );
    
    if( 
iFilePointer )
    {
        new 
iInputFilePointer fopenszTempFilePath"wt" )
        if( 
iInputFilePointer )
        {
            while( 
fgetsiFilePointerszDatacharsmaxszData ) ) )
            {
                if( 
szData] != EOS )
                {
                    
parseszDataszIdentity2charsmaxszIdentity2 ) );
                    
trimszIdentity2 );
                    
                    if( !
equaliszIdentityszIdentity2 ) ) 
                    {
                        
fprintfiInputFilePointerszData );
                    }
                }
            }
            
fcloseiInputFilePointer );
            
fcloseiFilePointer );
            
delete_fileszFormat ); 
            
rename_fileszTempFilePathszFormat);
        }
    }
    return 
0;

After creating the new file with remove the line of the user who expired the file does not deleted or renamed

Another question: Is it possible to do that by using "TrieDeleteKey" ?
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 02-12-2022 at 17:47.
Supremache is offline
 



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 11:43.


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