array size const - not working
#1

Code:

PHP код:
new const constLen sizeof(FILE_PATH_PLAYERDATA) + MAX_PLAYER_NAME 4;
new 
filePath[constLen];   // ERROR 
Compiler:

PHP код:
error 008must be a constant expressionassumed zero 

Where is the problem?


Btw:

PHP код:
new const constLen sizeof(FILE_PATH_PLAYERDATA) + MAX_PLAYER_NAME 4;
printf("%i"constLen); 
-> NO ERROR
Reply
#2

PHP код:
new filePath[sizeof(FILE_PATH_PLAYERDATA) + MAX_PLAYER_NAME 4]; 
Reply
#3

Quote:

new filePath[sizeof(FILE_PATH_PLAYERDATA) + MAX_PLAYER_NAME + 4];

It actually works! Thanks. But I don't know why.
Reply
#4

wth is this stupid thing...
why you add 4 ? max name length is 24
Reply
#5

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
wth is this stupid thing...
why you add 4 ? max name length is 24
4 is most likely the size of a file extension. If you didn't notice, the variable itself is called filePath.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)