problem with using variables as ofstream save locations

Hello all.
Working on CodeBlocks, GCC, windows XP, the codes dosn't make file at realtime.
Where is the problem?

1
2
3
std::string s;
s="asfil";
std::fstream(s.c_str());


or

1
2
3
4
5
char afile[20];
string asd="asfil";
strcpy(afile,asd.c_str());
std::fstream allfile(afile);
Last edited on
You need to create an ofstream for that
Thank's a lot
Topic archived. No new replies allowed.