T
thomas
Hi,
----------code----
int main(){
char Md5Str[34] = "670B14728AD9902AECBA32E22FA4F6BDx";
char Md5Value[1];
sscanf(Md5Str, "%02X", &Md5Value[0]);
}
--------------------
It gives me "run-time check failure #2 stack around the variable was
corrupted" error.
But I expected the Md5Value array is large enough to hold the only
value I interested in.
I searched the Internet and someone says that sscanf will append a
'\0' character in the end, so Md5Value size should be at least two.
But I still got error until Md5Value size is as large as 4. Also no
error suggested for the following code also makes me confused.
-----------------------------
int main(){
char Md5Str[34] = "670B14728AD9902AECBA32E22FA4F6BDx";
char Md5Value[1];
sscanf(Md5Str, "%c", &Md5Value[0]);
}
----------------------------
----------code----
int main(){
char Md5Str[34] = "670B14728AD9902AECBA32E22FA4F6BDx";
char Md5Value[1];
sscanf(Md5Str, "%02X", &Md5Value[0]);
}
--------------------
It gives me "run-time check failure #2 stack around the variable was
corrupted" error.
But I expected the Md5Value array is large enough to hold the only
value I interested in.
I searched the Internet and someone says that sscanf will append a
'\0' character in the end, so Md5Value size should be at least two.
But I still got error until Md5Value size is as large as 4. Also no
error suggested for the following code also makes me confused.
-----------------------------
int main(){
char Md5Str[34] = "670B14728AD9902AECBA32E22FA4F6BDx";
char Md5Value[1];
sscanf(Md5Str, "%c", &Md5Value[0]);
}
----------------------------