the uploaded is a assignment and i want to solve this task using the library fstream and using the tellp ,seekg other functions also can some body help me in that how to use all these things..!!I WROTE A FUNCTION ALSO BUT IT IS NOT READING THE FILE??? THE FUNCTION IS.--
#include "CSimpleList.h"
CSimpleList::CSimpleList(){};
void CSimpleList::loadFromFile(string filename)
{
if(filename == "")
{
cout<<"Enter valid filename"<<endl;
}
string line;
ifstream myfile("Phonebook.txt",ios::in);
if (myfile.is_open())
{
cout<<"file is opened"<<endl;
while ( myfile.good() )
{
cout<<"readin the line"<<endl;
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
}
int CSimpleList::size()
{
return m_list.size();
}
int CSimpleList::getNumber(int pos)
{
//trim(m_data,";");
int i=m_pos;
//i++;
int number;
string temp="";
//temp=m_data.substr(i);
while(i!=m_data.size())
{
temp+=m_data[i];
i++;
}
number=atoi(temp.c_str()); //convert string to integer
return number;
}
*/