这是在汇编中call scanf_s 输入Integer 的部分代码
char format[]="%d"; //format string for the scanf function
int first;
_asm{
lea eax,first
push eax
lea eax,format; 读取第一个number
push eax
call scanf_s
add esp,8
mov eax,dword ptr [first]
push eax
lea eax,format
push eax
call printf
add esp,8
}
_asm{
lea eax,input;
push eax;
lea eax,formats;
push eax;
call dword ptr[scanf];
add esp,8;
lea eax, input;
push eax
lea eax,formats;
push eax;
call dword ptr[printf];
add esp,8;
你的代码在有些VC版本是可以的。
输入字符串的话是不是要改成“%s”?