标题:文件字符串读写问题
取消只看楼主
leielf
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2006-8-16
 问题点数:0 回复次数:0 
文件字符串读写问题
#include<stdio.h> //先输入字符串,再输出。可是现在只有输入,不能输出,请问错在哪里??
main()
{
FILE *fp;
char ch,st[20];
if((fp=fopen("d:\\string.txt","a+"))==NULL)
{
printf("Cannot open file strike any key exit!");
getchar();
exit(1);
}
printf("input a string:\n");
scanf("%s",st);
fputs(st,fp); 为什么这句输不出字符,。
rewind(fp);
fgets(st,5,fp);
printf("\n");
fclose(fp);
}
搜索更多相关主题的帖子: 字符 文件 
2006-08-26 12:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-86246-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.418107 second(s), 10 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved