Is there a way to delete a line from a text file?
int posEndIdx;
int ipos=0;
string sLine;
string sKeyWord;
const string sDelim ( "]" );
try
{
fstream myInputFile("D:\\Logs\\CMS\\UnSended\\upload.text");
if( myInputFile.is_open() )
{
while( !myInputFile.eof() )
{
getline(myInputFile, sLine);
if(sLine.empty())
continue;
posEndIdx = sLine.find_first_of(sDelim);
sKeyWord = sLine.substr( posEndIdx+1, (sLine.length() - (posEndIdx+1)) );
cout<<sKeyWord<<endl;
//*******delete the line*******
}
myInputFile.close();
}
}
catch(...)
{
cout<<"Exception"<<endl;
}