I have a list of IPA (UTF-8) symbols in a text file called ipa.txt with numbers assigned to them. How do I cross reference it with a source file which is also a text file that contains a bunch of words and their corresponding IPA, to return a text file for every names with their names as their filename and inside the text file should contain their corresponding numbers of IPA.
Below is what I've tried but didn't work, only outputs were mostly 000000.
int main(){ std::unordered_map <wchar_t, int> map; std::wifstream file; file.open("ipa.txt"); if (file.is_open()) { std::cout << "opened ipa file"; } wchar_t from; int to; while (file >> from >> to) { map.insert(std::make_pair(from, to)); } std::wifstream outfile; outfile.open("source.txt"); if (outfile.is_open()) { std::cout << "opened source file"; } std::wstring id; std::wstring name; while (outfile >> id >> name) { std::ofstream outputfile; outputfile.open(id + L".txt"); for (wchar_t c : name) outputfile << map[c]; } system("pause"); return 0;}