store data from ifstream and store in link list
hi everyone, i have no idea on how to store values into a link list which data is from IFSTREAM
for example..the data.txt as below
192.149.089.061
100.001.004.031
034.056.078.012
192.149.089.061
100.001.004.031
192.149.089.061
111.022.033.004
192.149.089.061
111.022.033.004
111.022.033.004
and i want to stored it in link list .. how can i make it ???
this is my main code
Code:
int main()
{
IPlist ip;
ifstream myFile; //input file stream variable
char filename[40]; //filename is used to store the name of the input file
cout<<"Enter name of file : ";
cin>>filename;
myFile.open(filename); //open the input file
while(!myFile) //if open did not fail
{
myFile.clear();
cout << "Invalid file name" << endl;
cout << "Enter name of file : " ; //read the name of the input file
cin >> filename;
myFile.open(filename); //open the input file
}
while(myFile>> filename)
{
cout << filename << endl;
}
if (ip.empty())
system("pause");
return 0;
}
any help and idea will be really appreciated ... thank you