标题:[求助]矩阵数据写入txt文件
只看楼主
香草冰激淋
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2007-4-30
 问题点数:0 回复次数:0 
[求助]矩阵数据写入txt文件


我要实现的功能是将数组sam[5]中的5个数字写入文件in.txt中,编译没有出错,但结果in.txt中只有几个乱码.
这是为什么呢?请各位高手指教!
谢谢!

#include "stdlib.h"
#include "stdio.h"
FILE *fp;
main()
{
int sam[5]={1,0,0,1,1};
if((fp=fopen("e:\\in.txt","wb"))==NULL)
{
printf("cannot open the file\n");
exit(1);
}

fwrite(sam,sizeof(sam),1,fp);
fclose(fp);
}

搜索更多相关主题的帖子: txt 矩阵 数据 文件 
2007-05-29 15:45



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




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

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