#ifndef stockTab_h
#define stockTab_h
#include "media.h"
class StockTab {
public:
StockTab (); // Default Constructor.
private:
int itemCount; //number of stock items currently available
Media **mptr; // table of pointers to media objects. The last entry is NULL
};
#endif
#include "stockTab.h"
#include <iostream>
#include <fstream>
usingnamespace std;
StockTab::StockTab()
{
int size;
char line[50];
ifstream in ("stock.txt");
if(in.fail())
{
cout<<"file open failed"<<endl;
exit(1);
}
in>>size;
itemCount = size;
mptr = new Media *[itemCount];
char *tokptr = strtok(mptr,'/');
while (!in.eof())
{
in>>line;
while(tokptr!=NULL)
{
for(int i=0;i<itemCount;i++)
{
mptr[i] = new Media;
}
}
}
}
this will read data from a file example and needs to store in a pointer and tokenize it.....but it gives an error!!!
5
4/Gone with the wind/Sharon Stone/2005/35683546/S