How make in MFC C++:
i need a function, the function has read a txt file and put a message box with text which is in txt file.

How make in MFC C++:
i need a function, the function has read a txt file and put a message box with text which is in txt file.

Below is one way of doing it

void some_function()
{
    CStdioFile File;
    CString strLine;
    CString strMsg;

    if(File.Open("file.txt", CFile::modeRead))
    {
        while(File.ReadString(strLine))
        {
            strMsg += strLine + '\n';
        }
    }

    AfxMessageBox(strMsg, MB_ICONINFORMATION);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.