-1

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?

Newbie
  • 145
  • 2
  • 7
  • 23
  • I'm sorry, but what do you mean by blit? And What GUI library are you working with? is it (MFC, Qt, wxWidgets, etc..). Give us more information to be able to help you. – Baso Mar 09 '15 at 17:00
  • `TextOut` comes to mind, as does `DrawText`. For the differences between them (and doc links), see http://stackoverflow.com/q/8090148/62576 – Ken White Mar 09 '15 at 17:01

4 Answers4

0

I Think that will depend on the GUI framework you are using. Every GUI framework will have some display function you can use to display stuff(your text in that case).

Duly Kinsky
  • 996
  • 9
  • 11
0

If your GUI has a label widget, fill in the text in the label widget with label.setText(file-content-string) to display the text on the GUI.

Vivek
  • 320
  • 1
  • 5
0

Since you mention GetOpenFileName, I think you are working on Windows as that's a WIN API call. Assuming you don't want to build your project with direct use of the Windows API to create Windows (you aren't a masochist I take it), you could create an MFC project in Visual Studio (again assuming you are using Visual Studio).

0

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).

Sean
  • 60,939
  • 11
  • 97
  • 136