#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
using namespace std;
int main()
{
string temp;
ifstream inFile;
ofstream outFile;
inFile.open("ZRMK Matched - 010513.txt");
outFile.open("second.txt");
while(!inFile.eof()) {
getline(inFile, temp);
if (temp != "") {
getline(inFile, temp);
outFile << temp;
}
}
cout << "Data Transfer Finished" << endl;
return 0;
}
이 작업을 수행하는 데 어려움이 있습니다. 프로그램을 실행하면 잠시 동안 순환 한 다음 끝내지 않고 종료합니다. 출력 파일에 텍스트 행을 출력하지 않습니다. 어떤 도움을 주시면 감사하겠습니다.I/O 파일 스트림 C++
디버거를 사용 해본 적이 있습니까? '데이터 전송 완료'메시지가 출력됩니까? – Chad
출력 파일을 플러시하려고 했습니까? –
반복적으로 getline을 두 번 호출한다는 사실이 있습니다 (처음에는'(temp! = "" ")'를 확인하고 두 번째는 outfile에 쓰려고합니다) 의도적입니까? – fvu