Search code examples
c++textopenfiledialogblit

Opening text file in C++ and blitting result onto screen


How are you able to blit the result from a text file onto a C++ application GUI?

For example:

Text file contains ABC.

After I opened the text file from GetOpenFileName, how am I supposed to blit the result out since cout is unable to serve its function because its console based. Can anyone give me a direction to go? Thank you!

I've been goggling to find ways to do it but mostly blitting is for images, but what about text file? Is it actually possible?


Solution

  • It will depend on your windowing system. If you're using Windows then you can use either a static control or a a textbox control to hold the text. You use SetWindowText to pass the text you've read into the control.

    FYI: "blitting" isn't a term usually used to describe this sort of action. "Render" is probably a better term (in my opinion).