实现字符串计数程序,修改一下
#include "stdio.h"#include "string.h"
main()
{FILE *fp;
char str[20];
int ch;
scanf("%s",str);
if((fp=fopen(str,"w"))=NULL)
{printf("------");
}
if((ch=getchar())!=EOF)
{fputc(ch,str);
putchar(ch);
printf("%d",strlen(str));
}
fclose(str);
}