Best way of using MessageBox()?
I can't figure out a way to convert the string into something compatible with the second argument of MessageBox() I turned the project settings to using MultiByte and that helped a bit, but I'm still not quite getting this.
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nShowCmd)
//load a .txt file with a question in it
MessageBox(NULL,/*I want to put the string named line right here*/,"The Question",MB_OKCANCEL);
I'm just trying to make a simple program that asks a question and then shows you the answer. After I figure out how to make this part work, I'll be able to figure out the second.
the error that I usually get is
error C2664: 'MessageBoxA' : cannot convert parameter 2 from 'std::string' to 'LPCSTR' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
I understand the gist of this message, but I'm was unable to find a way I understood to convert string to LPCSTR after scouring the web for about 15 minutes
p.s. if there is a better substitute for ifstream for windows programming, I'd love to hear it. This is just the only way I know to read from a text file as of now