读书人

请教这个二进制的txt文件如何读不出来

发布时间: 2012-06-04 14:48:03 作者: rapoo

请问这个二进制的txt文件怎么读不出来啊??
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream fin;
char ch;int i=0;
fin.open("new_huhu.txt");
fin.get(ch);
do
{
fin.get(ch);
i++;
cout<<ch;
}while(!fin.eof());
cout<<endl<<i;
return 0;
}


这是我写的读txt文件


txt文件里的二进制是这些东西 01111011 01110000 01010001 00010111 00101001 01110010 00010111 00011011 01001111 01010110 00011010 00111110 01111100 00010100 00100101 01101010 00111100 01000101 01100110 01110011
01110101 01000110 01001
(按照二进制写入txt文件,转化为char储存)
读出来的时候没有全都出来 还有的没读出来啊


[解决办法]

探讨
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream fin;
char ch;int i=0;
fin.open("new_huhu.txt");
fin.get(ch);
do
{
fin.get(ch);
i++;
cout<<ch;
}while(!fin.……

读书人网 >C++

热点推荐