我正在尝试编写一个简单的 C++ 程序来打开一个 torrent 文件(通过 argv [1] 传递),读取所有文件,然后逐字打印整个文件的内容而不做任何更改,它必须打印副本原始洪流。问题是,一些种子可能包含日语、俄语等(文件名、描述等)......当然还有带有哈希值的标准种子数据等等。
这样做的最佳方法是什么?到目前为止,我只输出了一部分内容,而且它似乎没有正确读取或打印数据......它是乱码什么的:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#if defined(UNICODE)
#define _tcout wcout
#else
#define _tcout cout
#endif
int _tmain(int argc, TCHAR* argv[])
{
wifstream File(argv[1]);
wstring Line;
while(!File.eof() )
{
getline(File, Line);
_tcout << Line << endl;
}
File.close();
return 0;
}