My program displays common sayings in my language and it's using polish
specific characters. The program reads those sayings from text file
(*.txt) and everything is ok if I manually add some new sayings, save
them in Notepad and display in program with no problems. Those sayings
are organised in very simple way as lines:
[file]
Saying 1
Saying 2
<etc>
<here program should add new saying as a new line>
[/file]
However, if I use my option in my program "Add New Saying" then using
TextBox, how can I add new line in *.txt file where text (saying) is
taken from TextBox->Text property without losing polish characters? I
have used <fstreamlibrary and simple code below:
Expand|Select|Wrap|Line Numbers
- ofstream f_output("file.txt");
- char* txt = new char[TextBox->Text->Length + 1];
- for(int i=0; i<TextBox->Text->Length; i++) {
- txt[i] = Convert::ToChar(TextBox->Text[i]);
- }
- f_output << txt << endl;
- f_output.close();
- delete [] txt;
tried this with wchar_t but <fstreamis making mess with my file or i
still misses something.
Can you please help. Thanks =)