Why does 1 method work and other doesen't (cache_get_field_content)
#1

This works:
Код:
  		cache_get_field_content(0, "Name", string);
  		format(BaseInfo[baseid][bName], sizeof(string), string);
  		printf("Loaded base name, enum is now set to %s", BaseInfo[baseid][bName]);
But this doesen't:
Код:
  		cache_get_field_content(0, "Name", BaseInfo[baseid][bName]);
  		printf("Loaded base name, enum is now set to %s", BaseInfo[baseid][bName]);
My enum:
Код:
enum bInfo {
	bName[128],
The first method correctly prints out the result.. the other method doesen't print anything (blank).
Reply
#2

Because there is a 4th, optional, parameter which is the size of the buffer.
PHP код:
sizeof(string) 
Will return the size of the string as you would expect, however
PHP код:
sizeof(BaseInfo[baseid][bName]) 
Is invalid and therefore 0.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)