✔ 最佳答案
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
fstream file,file1;
file.open("past.txt",ios::in);
file1.open("new.txt",ios::out);
char str;
if(file)
if(file1)
while(!file.read(&str,sizeof(char)).eof())
if(str!='<'&&str!='>')
file1.write(&str,sizeof(char));
file.close();
file1.close();
system("pause");
return 0;
}
past.txt是有含<>
new.txt不含<>
有什麼問題再問吧!
2009-04-01 15:55:02 補充:
#include <iostream>
#include <stdlib.h>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
bool BOOL_writ=true;
fstream file,file1;
file.open("c.txt",ios::in);
file1.open("d.txt",ios::out);
char str;
if(file)
if(file1)
2009-04-01 15:55:21 補充:
接續
while(!file.read(&str,sizeof(char)).eof())
{
if(str=='<')
BOOL_writ=false;
if(BOOL_writ)
file1.write(&str,sizeof(char));
if(str=='>')
BOOL_writ=true;
}
file.close();
file1.close();
system("pause");
return 0;
}
2009-04-01 15:55:40 補充:
有什麼問題再問吧!