1.问题:使用C语言删除文本文档中的一行数据##
解决:test.txt 是要被删除一行数据的文本
#include<iostream>
#include<fostream>
using namespace std;
void Delete() {
int i=0;
ifstream intf("test.txt");
ofstream out("tmp.txt");
string str1;
while( intf >> str1 )
{
if ( i == 0 )
{
i=1;
continue;
}
out << str1 << endl ;
}
out.close() ;
intf.close() ;
ifstream intff("tmp.txt");
ofstream outt("test.txt");
while( intff >> str1 )
{
outt << str1 << endl ;
}
intff.close();
outt.close() ;
}