 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Gary Wessle Guest
|
Posted: Wed Aug 23, 2006 9:10 am Post subject: declaring a stream then defining it |
|
|
Hi
can I declare an ofstream in a class declaration in .h file and define
it inside a method in the .cpp file? if so, what does the syntax of
defining it looks like.
I tried
....
ofstream out; // in .h file
and
myclass::myfun(){
....
string s = "some.file";
out(s.c_str()); //in .cpp file
....
on the line above, I get
error: no match for call to '(std::ofstream) (const char*)'
so that another method uses it
myclass::myotherfun(){
out << ...
thanks |
|
| Back to top |
|
 |
Powered by phpBB © 2001, 2006 phpBB Group
|