开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
All
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
喂入的资料(Input):
预期的正确结果(Expected Output):
错误结果(Wrong Output):
程式码(Code):(请善用置底文网页, 记得排版)
#include <stdio.h>
int main ()
{
char sentence []="200a\n 1234\n";
char str [20];
int i;
unsigned long addr;
unsigned short port;
sscanf (sentence,"%x\n %d\n",&addr,&port);
printf ("%x -> %d\n",addr, port);
system("pause");
return 0;
}
预期会是
200a -> 1234
但是结果却是
0->1234
有人知道为什么吗?