why the exe no show in screen?


#include <iostream>
#include <string>
#include <fstream>
#include <conio.h>
using namespace std;


std::string& purehex()
{
ifstream ifs("sft.txt");
ofstream ofs("sft1.txt");
string strTmp,s;
int length;
char buffer[20];
while(getline(ifs,strTmp))
{ length=strTmp.copy(buffer,4,20);
buffer[length]='\0';
cout<< "cmd number: " << buffer << "\n";
s+=strTmp;
}
ofs<<s;
ifs.close();
ofs.close();
}

int main(int argc, char* argv[])
{
purehex();
cout<<"Hello!"<<endl;
getch();
return 0;
}

it can compile and link to exe .but it exit the output screen without control.why? the sft1.txt is also no content.why?




purehex() doesn't return a value so I think it would be a void.
Topic archived. No new replies allowed.