ofstream kim;
string filename;
cout<<"Enter Your Name:"<<endl;
cin>>filename;
kim.open(filename.c_str());
// after this one.. how can i put it in linked list??
if (!kim)
{
kim << "File could not be opened." << endl;
exit(1);
}
//////////////////////////////////////////////////////
// then, how can i determine or to call my file into this function
void insertFrontNode(void)
{
node*head2=new node;
cout<<"Enter a numeric item:";
cin>>head2->item;
if(head==NULL)
{
head2->next=NULL;
}
else
{
head2->next=head;
}
head=head2;
return;
}
/////////////////////////////////
//after that, how i will see the filename by using this function
void Traverse(void){
node*temp=new node;
temp=head;
while(temp!=NULL)
{
cout<<"\t\t|"<<temp->item<<"|"<<endl;
temp=temp->next;
}
return;
}
You need to think about how to store your data in your list
You should use strings to store the names in your file.
Take a look at the link below and use string where he uses int;