Thread: [Solved] Contain in .ini dont work
View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-29-2021 , 14:48   Re: Contain in .ini dont work
Reply With Quote #2

contain() and containi() return the index of the match. If it does not contain the string, it returns -1 (which will return true if used directly as the condition of an if statement). So, to properly check if a string contains another string, you need to use:

Code:
if( contain() >= 0 )
or
Code:
if( contain() != -1 )
P.S. you are reading the file incorrectly in your loop. You should use fgets() as the while loop condition. Also, you are potentially going to cause an index out of bounds because you are using the wrong value for the third argument of fgets(). You need to use charsmax(szFileData) instead of 50000.
__________________

Last edited by fysiks; 07-29-2021 at 14:51.
fysiks is offline