problem with strmid
#1

hello guys!

sorry about my english..

i tried to cut my String but i cant store it in the variable..
(btw, im doing this cut to cut the \r\n)
Код:
	    new File:myfile = fopen(file(playerid), io_read);
	    while (fread(myfile, String))
	    {
		       if(!strcmp(String, "IP", false, strlen("IP")))
                                strmid(PlayerInfo[playerid][IP], String, strlen("IP="), strlen(String) - 2);
             }
this is the code
i did some checks and i saw that the variable PlayerInfo[playerid][IP] does not have any value ( i mean "")

so i tried another way:

Код:
	    new File:myfile = fopen(file(playerid), io_read);
	    while (fread(myfile, String))
	    {
		       if(!strcmp(String, "IP", false, strlen("IP")))
		       {
                                new string[100];
                                strmid(string, String, strlen("IP="), strlen(String) - 2);
				format(PlayerInfo[playerid][IP], 20, string);
			}
             }
and now it works!

my question is why in the first try it ddidnt work?

btw the enum is:
Код:
enum pInfo
{
...
IP[30],
...
}
the variable is:
Код:
new PlayerInfo[MAX_PLAYERS][IP]
thanks for all helpers
Reply
#2

BUMP!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)