 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
thinktwice Guest
|
Posted: Thu Aug 24, 2006 7:10 am Post subject: what's the difference betwwen these two ways to use std::ofs |
|
|
//case 1, works fine
function(..)
{
std::ofstream out;
out.open(file);
out << "error info" <<endl;
out.close();
}
//case 2, declare it in a class
class Logger
{
public:
Logger(std::wstring file, std::ios_base::openmode mode /*undefined
too, why?*/){}
private:
std::ofstream out; //error c2079, uses undefined class
'std::basic_ofstream<_Elem, _Traits>'
}
btw, how to use ios_base:openmode? is it declared in std namespace? |
|
| Back to top |
|
 |
thinktwice Guest
|
Posted: Fri Aug 25, 2006 9:10 am Post subject: Re: what's the difference betwwen these two ways to use std: |
|
|
thanks Persson , you are right,
i do include <fstream> in cpp file.
and the function implementation and the class definination is in the
header file. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|