用fputc把字符写入指定的文件中

#include<stdio.h>
int main()
{
FILE*fp;
char chs[10]={‘L’,‘O’,‘V’,‘E’};
fp=fopen(“hello.txt”,“wt”);
if(fp!=NULL)
{
fputc(chs[0],fp);
fputc(chs[1],fp);
fputc(chs[2],fp);
fputc(chs[3],fp);
}
return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_44262430/article/details/88616237