69,373
社区成员
发帖
与我相关
我的任务
分享
// crt_scanf_s.c
// This program uses the scanf_s and wscanf_s functions
// to read formatted input.
#include <stdio.h>
int main( void )
{
int i,
result;
float fp;
char c,
s[81];
wchar_t wc,
ws[81];
result = scanf_s( "%d %f %c %C %s %S", &i, &fp, &c, 1,
&wc, 1, s, 80, ws, 80 );
printf( "The number of fields input is %d\n", result );
printf( "The contents are: %d %f %c %C %s %S\n", i, fp, c,
wc, s, ws);
result = wscanf_s( L"%d %f %hc %lc %S %ls", &i, &fp, &c, 2,
&wc, 1, s, 80, ws, 80 );
wprintf( L"The number of fields input is %d\n", result );
wprintf( L"The contents are: %d %f %C %c %hs %s\n", i, fp,
c, wc, s, ws);
}
我用的scanf是在VS2012下的scanf_s,难道是因为这个函数的原因?
哪有问题了?
你说清楚你是怎么操作的 程序输出 ccccc 之后 你干了些什么 而程序是怎么反应的?
[quote=引用 3 楼 zxh707wk 的回复:] 哪有问题了?