51Testing软件测试论坛
标题:
请教下:关于LR的 sscanf 函数
[打印本页]
作者:
shinetony
时间:
2012-4-2 11:38
标题:
请教下:关于LR的 sscanf 函数
看了帮助文档,例子如下:
Action() {
char sentence[] = "After 7 years' siege yet Troy walls stand";
char s1[32], s2[32];
int num_of_years;
sscanf(sentence,"%s %d %s", s1, &num_of_years, s2);
lr_output_message("Number of years=%d s2=\"%s\"", num_of_years, s2);
return 0;
}
Output:
Action.c(7): Number of years=7 s2="years'"
有个地方不明白 : sscanf(sentence,"%s %d %s", s1, &num_of_years, s2);
我去掉&num_of_years前面的 & 之后就报错:
Action.c(7): Error: C interpreter run time error: Action.c (7): Error -- memory violation : Exception ACCESS_VIOLATION received.
请问这是什么问题?
作者:
msnshow
时间:
2012-4-4 21:30
规定的语法是这样的
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2