I'm trying to write a struct to a textfile (txt) after the user has entered: name, haircolor, age and weight. The issue I'm facing is the output in the textfile is korean characters.
This is a seperate file "hero.cpp" which handles the subprograms. There is also a main.cpp and hero.h file.
I tried writing the same code in a separate program and it works properly. I don't know if it's different because it is written in the main program (main.cpp).
jonnin I don't use an overloaded operator. Do you mean that "utdata << strukt.name;"
isn't the correct usage to send data to a textfile via a ofstream?
The thing is that I wrote another program to figure out how streams worked before writing the current program. The only difference is that the program below is written in the main.cpp file.
... ok, do this. print to the screen/console what you think you write to the file in the broken code version.
also, I didnt say anything about overloaded << ... you are using it correctly. You can overload << so the entire struct is written instead of doing it one field at a time, and that is cleaner, but that isnt related to your issue.