Class Usage
I have defined the following class:
//-----------------------------------------------------------------
class LogFunctions // Log/Audit File class
{
public:
LogFunctions::LogFunctions(char *fileName); // constructor
LogFunctions::~LogFunctions(); // destructor
void LogFunctions::openLog(char *fileName); // open Log file
void LogFunctions::putLog(char *line); // write->Log/Audit file
void LogFunctions::scanLog(); // scan Log/Audit file
void LogFunctions::closeLog(); // close current log/audit file
static int listFile(char *fileName); // lists named file
private:
static void cursor(char row, char col);
static void initScr(void);
static char *fileReadRecord(long);
static void parseStr(char *str); // parse string from file buffer
typedef unsigned long ULONG;
};
//-----------------------------------------------------------------
and I am having difficulty using this class as an object pointer. I
need to use it several times (with different files) throughout the
execution of my application. That is, I want to have several files
concurrently opened, writing, being scanned, etc. within the same
program. Thus, I thought would do the following:
//-----------------------------------------------------------------
LogFunctions *l_c = NULL;
....
LogFunctions *l_c = new LogFunctions("testfile.log");
....
l_c->putLog("Some textual data");
l_c->scanLog();
etc.
....
l_c->closeLog();
delete(l_c);
//-----------------------------------------------------------------
This sort of code generates all sorts of compile errors (which don't
help me understand what I did wrong), and I know I've badly confused the
concepts of class definition and instantiation...8<}}
So, if my explanation of my intent makes sense, I'd appreciate some
guidance as to how actually implement this logic... TIA