Can someone explain this code to me?
#1

I have
PHP код:
format(FactionInfo[fID][fName],100,inputtext); 
But I don't know why you need the 100 there or the format? I was thinking just
PHP код:
FactionInfo[fID][fName] = inputtext
but that gives me this error
Quote:

array sizes do not match, or destination array is too small

Reply
#2

It specifies the size of the array.
Reply
#3

100 is the size of fName[HERE] in enum, inputtext has undefined size so error because u can't set array[100] = inputtext[undefined_size];
Reply
#4

So Jeff you're saying that code won't work?
Reply
#5

The second method would only work if both strings had the same size. If their lenghts do not match, then it gives the warning.

You format to FactionInfo[fID][fName] with max lenght of the string to 100 what inputtext "holds" in it. format is a bit slower than other methods, for example strcat or strins is faster.
Reply
#6

In format works
Reply
#7

So the format allows for the inputtext to be equal to 100 characters?
Reply
#8

The inputtext can be even higher on lenght; however FactionInfo[fID][fName] will only store 99 characters + NULL.
Reply
#9

Okay thanks for the help
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)