Почему я не получаю вывод файла с wofstream?

Мой код здесь:

//wstring filename = temp.name + L".txt";
wstring filename = L"hero2.txt";
//wofstream File(filename.c_str());
wofstream outputFile(L"temp.txt", ios::ate | ios::binary);
if (outputFile.fail()) windowmsg(1, LPCWSTR(L"Could not Save game"));
else windowmsg(1, LPCWSTR(L"Game Saved"));

wchar_t BOM = 0xFEFF;//Byte Order Mark character
outputFile << BOM;

outputFile << temp.name << endl;
outputFile << temp.lvl << endl;
outputFile << temp.HP <<endl;
outputFile << temp.minHP <<endl;
outputFile << temp.MP <<endl;
outputFile << temp.minMP <<endl;
outputFile << temp.ATK <<endl;
outputFile << temp.DEF <<endl;
outputFile << temp.mATK <<endl;
outputFile << temp.mDEF <<endl;
outputFile << temp.SPD <<endl;
outputFile << temp.exp <<endl;
outputFile << temp.exptonext <<endl;
outputFile << temp.gearnumber <<endl;
for (int count = 0 ; count < temp.gearnumber ; count++)
{
outputFile << temp.equip[count].name <<endl;
outputFile << temp.equip[count].type <<endl;
outputFile << temp.equip[count].ATK <<endl;
outputFile << temp.equip[count].DEF <<endl;
outputFile << temp.equip[count].mATK <<endl;
outputFile << temp.equip[count].mDEF <<endl;
outputFile << temp.equip[count].SPD <<endl;
}

Я перепробовал много вещей, я не могу вспомнить их все, чтобы изложить их здесь. Например, изменение второго параметра в fstream на ios::ate | ios::binary и тому подобное. Я попытался преобразовать пустой текстовый файл в UTF, с и без спецификации, я пытался написать спецификацию в коде C ++, прежде чем писать какие-либо переменные. Я всегда просто получаю пустой файл.

Кодировка проекта — это набор символов Unicode. Как примечание, мне действительно все равно, какой будет кодировка файла, я буду писать в него только текст на английском языке. Так что пока он пишет файл, я счастлив.

2

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector