书上的原码,但是为什么会有错
/* ex02-05.c*/#include <stdio.h>
#include <string.h>
int main(void)
{
char buffer[256];
printf("Enter your name and press <Enter>:\n");
fgets( buffer );
printf("\nYour name has %d characters and spaces!",
strlen(buffer));
getch();
return 0;
}
下面是提示的错误
F:\Microsoft Visual Studio\MyProjects\lianxi2625\lianxi2625.c(9) : error C2198: 'fgets' : too few actual parameters
F:\Microsoft Visual Studio\MyProjects\lianxi2625\lianxi2625.c(14) : warning C4013: 'getch' undefined; assuming extern returning int
执行 cl.exe 时出错
搞不懂是为什么,和书上一模一样的啊!