![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 48
Rep Power: 0
![]() |
Is there a way to delete a line from a file?
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;
} |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|