I'm trying to write a simple C++ program to open a torrent file (Passed through argv[1]), read all of it, and then print the entire file's contents verbatim with no alterations, it has to print a carbon copy of the original torrent. The issue is, some of the torrents may contain Japanese, Russian, etc. (FIlenames, description, etc.)... And of course the standard torrent data with the hashes and whatnot.
What's the best way to go about doing this? What I have so far only outputs a portion of the contents, and it doesn't seem to read or print the data correctly... It's garbled or something:
#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;
}