Troubles with string ..
#1

Hello, i need help with this:
Код:
stock FileWriteString(key[], value[])
{
	if(strlen(key) > MAX_FILE_KEY_LENGHT || strlen(value) >= MAX_FILE_VALUE_LENGHT)
	    return -1;
	strcat(FileInfo[FileLine][Key], key);
	strcat(FileInfo[FileLine][Value], value);
	FileLine++;
	return 1;
}
I dont know why, but the text (FileInfo[FileLine][Key] & FileInfo[FileLine][Value]) is always null.
Код:
enum FileReadWriteInfo
{
	Key[MAX_FILE_KEY_LENGHT],
	Value[MAX_FILE_VALUE_LENGHT]
}

new FileInfo[MAX_FILE_LINES][FileReadWriteInfo];
When i try to use format, i got these error messages:
Код:
error 001: expected token: "]", but found "-identifier-"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Any ideas?

Thanks.
Reply
#2

Quote:
Originally Posted by Kaczmi
Посмотреть сообщение
Hello, i need help with this:
Код:
stock FileWriteString(key[], value[])
{
	if(strlen(key) > MAX_FILE_KEY_LENGHT || strlen(value) >= MAX_FILE_VALUE_LENGHT)
	    return -1;
	strcat(FileInfo[FileLine][Key], key);
	strcat(FileInfo[FileLine][Value], value);
	FileLine++;
	return 1;
}
I dont know why, but the text (FileInfo[FileLine][Key] & FileInfo[FileLine][Value]) is always null.
Код:
enum FileReadWriteInfo
{
	Key[MAX_FILE_KEY_LENGHT],
	Value[MAX_FILE_VALUE_LENGHT]
}

new FileInfo[MAX_FILE_LINES][FileReadWriteInfo];
When i try to use format, i got these error messages:
Код:
error 001: expected token: "]", but found "-identifier-"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Any ideas?

Thanks.
Код:
error 001: expected token: "]", but found "-identifier-"
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
That is saying that your missing a ] in one place and the ; in the other. Is there anyway that you could paste the line numbers from the errors as well as from the .pwn file or better yet, just copy and paste the particular line that the error is referring to
Reply
#3

Quote:
Originally Posted by Blade_Cervetti
Посмотреть сообщение
That is saying that your missing a ] in one place and the ; in the other. Is there anyway that you could paste the line numbers from the errors as well as from the .pwn file or better yet, just copy and paste the particular line that the error is referring to
Код:
format(FileInfo[FileLine][Key], sizeof FileInfo[FileLine][Key], key);
Tell me, what is wrong on this line, i do not see any problem but compiler does.
Reply
#4

Код:
format(FileInfo[FileLine][Key], sizeof(FileInfo[FileLine][Key]));
I'm not entirely sure, but try this
Reply
#5

It is the same dude, also you miss )
Reply
#6

it is not the same, you are not using a ( after sizeof, insteading your using []s
Reply
#7

Well you can try it, Iґm doing it always.
Код:
sizeof string
is equal to
Код:
sizeof(string)
Reply
#8

Look if you want help, then take some advice when it's given. If not, then don't ask for help.

Maybe you should take a look at this>..... Formatting Strings
Reply
#9

Quote:
Originally Posted by Blade_Cervetti
Посмотреть сообщение
Look if you want help, then take some advice when it's given. If not, then don't ask for help.
Well when you are figting with me about something you are not sure about then I cannot take any advice. I need a solution of my problem, not your advices about formating string. Iґm programming for 4 years, but this is completely new (working with string) for me so dont be rude and try it by yourself or leave. There are other guys that could help me.
Reply
#10

Okay, first off, I wasn't fighting with you. I was merely suggestion. Also, I am not sure what you're working with so thats a little hard to try for myself. Secondly, if you want to know something about pawn scripting you need to look it up with the pawn scripting resources. Thridly, Programming other things, isn't neccessarily the same as pawno language. Trust me, I have my certification in PHP C++ C-- HTML codings. So again, I wasn't being rude or fighting, I was merely suggesting. But it's okay, I won't attempt to help anymore.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)