I have an application that uses fonts, user can change the look of fonts and
their color. I want to save those font settings in a file, so each time user runs
my program the same fonts appear...
I have a LOGFONT struct full of data that needs to be saved in a file, and loaded.
Heres how i do it:
And this doesn't work as always... Well sometimes it does, but mostly theCode:// General using namespace std; #include <fstream> LOGFONT font; ........... ........... // Loading ifstream fin; fin.open("config.txt"); fin>>font.lfFaceName; fin>>font.lfCharSet; fin>>font.lfClipPrecision; fin>>font.lfEscapement; fin>>font.lfOrientation; fin>>font.lfHeight; fin>>font.lfItalic; fin>>font.lfStrikeOut; fin>>font.lfUnderline; fin>>font.lfOutPrecision; fin>>font.lfPitchAndFamily; fin>>font.lfQuality; fin>>font.lfWeight; fin>>font.lfWidth; ........... ........... // Saving ofstream fout; fout.open("config.txt"); fout<<font.lfFaceName<<endl; fout<<font.lfCharSet<<endl; fout<<font.lfClipPrecision<<endl; fout<<font.lfEscapement<<endl; fout<<font.lfOrientation<<endl; fout<<font.lfHeight<<endl; fout<<font.lfItalic<<endl; fout<<font.lfStrikeOut<<endl; fout<<font.lfUnderline<<endl; fout<<font.lfOutPrecision<<endl; fout<<font.lfPitchAndFamily<<endl; fout<<font.lfQuality<<endl; fout<<font.lfWeight<<endl; fout<<font.lfWidth<<endl;
structure is filled with very wierd data.
Why doesn't this work? How should it work?