Raised This Month: $ Target: $400
 0% 

Trying to remove the ; at the start of a line in a file..


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-26-2006 , 10:51   Trying to remove the ; at the start of a line in a file..
Reply With Quote #1

Code:
public MODULE_Enable( module_name[] ) {     new fp = fopen( "addons/amxmodx/configs/modules.ini", "r+t" );     new data[128];     while( !feof( fp ) )     {         fgets( fp, data, 63 );                 server_print( "Searching %s", data );         // Module Name Found         if ( contain( data, module_name ) != -1 )         {             // Semicolon before module name found             if ( contain( data, ";" ) != -1 )             {                 // Lets go to the start of the line we're on so we can remove the ;                 fseek( fp, strlen(data), SEEK_CUR );                                 // Remove the ; from the line                 replace( data, strlen(data), ";" , "" );                 server_print( "%s", data );                                 new len = strlen( data );                 for ( new i = 0; i < len; i++ )                 {                     fputc( fp, data[i] );                     server_print( "%c:%s", data[i], data[i] );                 }                 server_print( "done" );             }         }     }     fclose( fp ); }

I'm trying to JUST remove the semicolon at the start of the line when the appropriate module is found...

How can I achieve this? It's not actually working :/ It gets in an infinite loop and prints and prints the same crap in the file for like an eternity...

Thanks,
Josh
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
 



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


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