Hi,
I'm having a problem with taking the user input from a richtextbox in Unicode and writing it to a Unicode text file.
I'm able to read a different Unicode file and write it to the new file, but when it comes to writing the contents of the richtextbox to the new file, nothing appears.
I've tried debugging it, and I can see that the wstring is assigned correctly, I just can't see why this won't write to file.
What am I doing wrong?
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
std::wifstream inFile(L"testin.txt", std::ios::in | std::ios::binary);
std::wofstream outFile(L"test.txt", std::ios::app | std::ios::binary);
std::wstring my_string;
while(getline(inFile,my_string))
{
outFile<<my_string + L"\x0a\x00";
}
const wchar_t* chars = (const wchar_t*)(Marshal::StringToHGlobalUni(richTextBox1->Text)).ToPointer();
std::wstring str1(chars);
outFile<<str1 + L"\x0a\x00";
outFile.close();
}
Thanks in advance!