#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
int main()
{
ifstream ifs;
ifs.open("haha.jpg", ios::out);
string str = "";
string connect = "";
while(!ifs.eof())
{
ifs>>str;
connect = connect + str;
}
ifs.close();
//cout<<"connect: " <<connect <<endl;
cout<<"length: "<<connect.length()<<endl;//length: 12345
char temp[1024*300] = {0};
//strncpy(temp, connect.c_str(), connect.length());
memcpy(temp, connect.c_str(), connect.length());
cout<<"length: "<<strlen(temp)<<endl;//temp里的数据为何不对头
//cout <<"temp: "<<temp <<endl; //为何打印不出来呢
}