i have a task how to link two files
to read from oneanother
like a search
this is what i have

please help
this is urgently needed


ofstream outfile;
fstream myfile;

outfile.open("Inventory.txt");
myfile.open("Invoice.txt");
outfile<< "\n\nWELCOME TO THE INVENTORY\n";
outfile<< "========================\n";
outfile<<"Item ID"<<setw(10)<<"Name"<<setw(16)<<"Descrition";


cout<<"Please fill in the following information\n\n";
cout<<"Item ID: ";
cin>>ID;
cout<<"Name: ";
cin >>name;
cout<<"Description: ";
cin>>description;
outfile<<ID<<setw(9)<<name<<setw(10)<<description;

myfile<<"\n\n WELCOME TO INVOICE\n";
myfile<<"=======================\n";
cout <<"Enter item ID: ";
cin>>IDs;
for (int i =0; i<=ID; i++)
{
if(IDs == ID)
{
cout <<"ID found";
}
}
this loop is not correct
i want to be able to search in the
inventory file for the corresponding ID
typed here in the invoice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.