Raised This Month: $32 Target: $400
 8% 

reading from ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sp@jk
Member
Join Date: May 2010
Location: Serbia
Old 08-20-2011 , 12:41   reading from ini
Reply With Quote #1

so, I have a file called bla.ini and there is a line:
Code:
"1. arg" "2. arg" "3. arg"
so, I read that line, but how can I get 1. arg, 2. arg and 3. arg ?
so, I need to put "1. arg" to arg1[len], "2. arg" to arg2[len] and "3. arg" to arg3[len]

somebody understands ?
Sp@jk is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-20-2011 , 12:47   Re: reading from ini
Reply With Quote #2

PHP Code:
new szDirectory256 ];
get_configsdirszDirectorycharsmaxszDirectory ) );

addszDirectorycharsmaxszDirectory ), "/config.ini" );

new 
iFile fopenszDirectory"rt" );

new 
szBuffer256 ], szArg132 ], szArg232 ], szArg332 ];

while( !
feofiFile ) )
{
    
fgetsiFileszBuffercharsmaxszBuffer ) );
    
    
parseszBufferszArg1charsmaxszArg1 ), szArg2charsmaxszArg2 ), szArg3charsmaxszArg3 ) );
    
    
// szArg1 contains "1. arg"
    // szArg2 contains "2. arg"
    // szArg3 contains "3. arg"

__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Sp@jk
Member
Join Date: May 2010
Location: Serbia
Old 08-20-2011 , 12:51   Re: reading from ini
Reply With Quote #3

I thinked that parse would "cut"
Code:
"1. arg" "2. arg" "3. arg"
to "1. arg" "2. arg" "3. arg"
Sp@jk is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-20-2011 , 12:54   Re: reading from ini
Reply With Quote #4

If you have quotes around sets of text, then parse will treat everything in that quote as one string.

So like I said, from the previous code

szArg1 would have "1. arg"
szArg2 would have "2. arg"
and szArg3 would have "3. arg"
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Sp@jk
Member
Join Date: May 2010
Location: Serbia
Old 08-20-2011 , 12:55   Re: reading from ini
Reply With Quote #5

ok, thanks
Sp@jk 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 15:13.


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