#include <sstream> #include <fstream> #include <codecvt> #include <deque> #include <iostream> #include <fcntl.h> #include <io.h> int main() { _setmode(_fileno(stdout), _O_U8TEXT); std::wstring wstr; std::locale::global(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>)); std::deque<std::wstring> lines, words; std::wifstream wif(L"C:/Users/Administrator/source/repos/ConsoleApplication1/x64/Debug/data.txt"); if (wif.is_open()) { std::wstringstream wss; wss << wif.rdbuf(); wstr = wss.str(); wif.close(); } else { std::wcout << L"Не удалось открыть файл!"; } { std::wstringstream wss(wstr); std::wstring temp; while (std::getline(wss, temp, L'\n')) lines.push_back(temp); } { for (std::wstring i : lines) { std::wstringstream wss(i); std::wstring temp; while (std::getline(wss, temp, L' ')) words.push_back(temp); } } std::wcout << words[6]; } 01.01.2014 Старт Кошелёк 990 Изначально в кошельке было 990 руб 01.01.2014 Старт Карта 7000 А на карте 7000 20.09.2014 Кошелёк Проезд 70 Заплатил за проезд 20.09.2014 Кошелёк Базар 500 Купил фруктов на базаре asd 2014-09-21 Карта Книги 770.31 Купил книжку по карточке 2014-09-21 Карта Кошелёк 770.31 21.02.2014 Карта Кошелёк 1000 Снял тысячу в банкомате - - - - - UPD. I need to skip lines with invalid date, invalid format... I forgot my iss... in order to fix line by line appending to deque... we do not care about commentary existance we care about existance 4 first items like date, source, destination, amount..