the below function loads 2 strings from a file:
int loadsettings()
{
wstring a,b;
int retrn = 1;
wfstream myFile;
myFile.open ("settings.txt");
if ((!myFile.is_open())||(myFile.fail()))
MessageBox(NULL, "Error openning settings file!", "Error", MB_ICONINFORMATION);
else
{
if(myFile.fail())
{
myFile.close();
myFile.clear();
retrn = 0;
savedefault(); //creates a settings.txt with default values
myFile.open ("settings.txt", ios::in);
}
myFile >> b; //b becomes "user"
myFile >> a; // a becomes "password"
user = (LPARAM)b.c_str();
password = (LPARAM)a.c_str();
SendMessage(hEdit,
WM_SETTEXT,
NULL,
user); // sets the text box to "u"
SendMessage(hEdit2,
WM_SETTEXT,
NULL,
password); //sets the text box to "p"
myFile.close();
}
return retrn;
}
I want to gave the two strings taken from the file go to the textboxs hEdit and hEdit2. Try to do that with the Sendmessage settext. But only the first character in the string gets there. what should I do?