Using a macro for fstream file input as part of a class
Posted
by vette982
on Stack Overflow
See other posts from Stack Overflow
or by vette982
Published on 2010-05-21T02:26:31Z
Indexed on
2010/05/21
2:30 UTC
Read the original article
Hit count: 245
I have a class that processes a file, and as part of the constructor with one argument I want to input a file using fstream
.
I basically want it do something like this
class someClass{
public:
someClass(char * FILENAME)
{
fstream fileToProcess;
fileToProcess.open(<FILENAME>, fstream::in | fstream::out | fstream::app);
}
};
I want to pass the filename in as an argument to the class constructor, and then the class someClass
will access it with fstream
.
© Stack Overflow or respective owner