Namely, I use ofstream and in the file itself it is recorded in Russian beeches well, but with the name of the problem document. What just did not try, the file name turns out something like this .txt (неверная кодировка)
Maybe I did not quite correctly ask the question, I need the program to save the txt file with the names аа.txt аб.txt ав.txt - ... - яя.txt
I will briefly describe the essence of the program: There is a dictionary of words, arranged in alphabetical order, the program must break this dictionary into 33 * 33 documents (Minus 3 * 32 , there are no words beginning with ь, ь, ъ). The document аб.txt will have all the words beginning with ab ...
The record in the files is correct, the only thing is that the file names are incorrect
Here is my main() function:
int main() { if (rfile.is_open()) { while (getline(rfile, line)) { string first, second; try { first = line[0]; second = line[1]; }catch (...) { continue; } if (first == " " || first == "." || first == "-" || first == "|" || first == "," || second == " " || second == "|" || second == "-" || second == "." || second == ",") continue; string wfilename = first + second + ".txt"; ofstream wfile; wfile.open(wdirectory + wfilename, ios_base::app); if (wfile.is_open()) wfile << line; wfile.close(); } rfile.close(); } else cout << "Unable to open file" << endl; return 0; } Linux mint x64
Solution found! I took the first two letters of the line and used them to compose the name. For everything to work correctly, it was necessary to convert the source file to utf-8 . On linux this command looks like iconv -f windows-1251 < /home/user/filename.txt > /home/user/newEncodedFilename.txt Signs < and > required. Next, use the new file. Thank you sercxjo
.txt (неверная кодировка)- Herrgott