#include <iostream> #include <string> using namespace std; int main(int argc, _TCHAR* argv[]) { FILE* pfile = fopen("D:\origin.txt", "rb"); if (!pfile) return false; fseek(pfile, 2, 0); wchar_t buf[1024]; wstring line; wstring newl = L"x000Dx000A"; while (!feof(pfile)) { fgetws(buf, 1024, pfile); line = buf; if(line.find(newl)!=wstring::npos) line = line.substr(0, line.find(newl)); } fclose(pfile); }