Hi Gurus,
I'm not able to get this code to work. Can any one help please?
Code:
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string c,d = "";
fstream reads;
reads.open("R0_1st.txt",ios ::in);
fstream writes;
writes.open("new.txt",ios::in|ios::out);
reads.unsetf(ios::skipws);
while ( getline ( reads, c ) ) {
cout<<c<<endl;
if ( c.find ( "Adiabatic Efficiency" ) != string::npos )
{
cout<<">>>>>>>>>>>>>>>"<<endl; //Just to make sure it got here
while( getline (writes,d) )
{
if ( d.find ("replace here") != string::npos )
{
cout<<"<<<<<<<<<<<<<<<"<<endl; //Just to make sure it got here
writes<<c;
}
}
}
}
return 0;
}
The textfile returns nothing. Does anyone know where I am going wrong?
Thanks,
Sheilah