#define N 50
void main()
{
char buf[50];
int i;
printf("最多输入50个数字\n");
scanf("%s", buf);
for (i = 0; i != strlen(buf); ++i)
{
if (buf[i] < '0' || buf[i] > '9')
{
printf("输入的字符有非数字,程序退出!\n");
return;
}
}
FILE *pfile;
pfile = fopen("outfile.txt", "wb");
fwrite(buf, 1, strlen(buf), pfile);
fclose(pfile);
}