|
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{ string bl;
ofstream o;
o.open("d://123/789.txt");
if (!o)
{
cout << "没有打开" << endl;
return 0;
}
char gr[100] = { "hhhhhhhhhhhhhhh\n\t" };
bl = "hfskjdhfkdf\n\t";
o.write((char*)&bl, sizeof(bl));
o.write((char *)&bl, sizeof(bl));
string j="hj";
ifstream n;
n.open("d://123/789.txt");
if (!n)
{
cout << "没有打开" << endl;
return 0;
}
n.read(( char*)&j,sizeof(j));
cout << j << endl;
return 0;
}
求助为什么n.read(( char*)&j,sizeof(j));不起作用?是什么原因导致的. |
-
n.read(( char*)&j,sizeof(j));为什么不起作用
上一篇: c++新手求助下一篇: WinHttpRequest到send就崩溃
|