Getting a certain string in a file
#1

Hello,

I want to get a certain string out a file. For example: a Player Name. How do I do this with dini? I tried: dini_Get, dini_Int (and I was ensured it wouldnt work cause it is 'integer'). What do I need to use?

Regards, Jochem
Reply
#2

If it's a .ini-file use dini_Get. If not, store the whole file in a string, and then use strfind to find the value you are looking for. Anyway i think the strfind sollution is no real sollution, if it's a .ini file, really use dini_Get.
Reply
#3

Can you show me how to check for an empty key?
Reply
#4

Use the isnull macro.

pawn Код:
#define isnull(%1)                        (!%1[0] || (%1[0] == '\1' && !%1[1]))
Reply
#5

How to use that?
Reply
#6

if(isnull(stringVar))

returns false if the string contains more than \1 and \0 (empty space and null)
returns true if the string is empty (contains only space and/or null)
Reply
#7

pawn Код:
if(isnull(dini_Get("JoAdmin/Configuration/HouseInfo.ini","House1Owner")))
= giving errors...
Reply
#8

Really, what is wrong in that? I also tried it with a variable, giving errors...
Reply
#9

What errors?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)