Raised This Month: $51 Target: $400
 12% 

Get a line from a .ini file, and compare


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
uurbyrkdr
Senior Member
Join Date: Apr 2015
Old 04-11-2016 , 08:30   Get a line from a .ini file, and compare
Reply With Quote #1

Hi.
I want to compare a string, with all of the lines from a .ini file.
How can i do this?
uurbyrkdr is offline
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 04-11-2016 , 09:00   Re: Get a line from a .ini file, and compare
Reply With Quote #2

That does depend...

Can you give us short example of the ini file and string?
__________________
Plugins: TeamGames
Includes: Menu stocks, ColorVariables, DownloadTableConfig

> No help through PM, make a topic.

Last edited by KissLick; 04-11-2016 at 09:01.
KissLick is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 04-11-2016 , 09:24   Re: Get a line from a .ini file, and compare
Reply With Quote #3

Something like this?

PHP Code:
char filename[PLATFORM_MAX_PATH];
BuildPath(Path_SMfilenamesizeof(filename), "configs/yourfile.ini");

File file OpenFile(filename"r");
if (!
file)
{
    
SetFailState("Could not open file!");
}

char line[256];
while (
file.ReadLine(linesizeof(line)))
{
    
TrimString(line);
    
    if (
StrEqual(line"yourtext"))
    {
        
// Do something
        
break;
    }
}

file.Close(); 
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami 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 06:08.


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