Is the streams library useful in GUI programs?

Hi all.
I've been learning c++ since a few months and i'm still writing console programs. These days i've been looking a bit at the streams library, iostream and stuff, and i'm wondering if the functions that are so useful in command-line programs for inputting and outputting data (like get(),getline(),cin,cout...etc) can be also used when writing GUI programs.
My aim is to be able to write some nice graphical programs one day, so i want to know whether all the input/output techniques i am learning right now will be equally relevant later.
Thanks.
If you're planning to read/write text files, then yeah. Stuff that applies to cin/cout apply to fstreams as well.

For actual IO with the program, though, no. That is done totally differently.
Last edited on
Similar techniques are useful using stringstreams, though. Here's an example Windows console program that displays a message box showing the value of an integer. Note the hideousness.

1
2
3
4
5
6
7
8
9
#include <windows.h>
#include <sstream>

int main(){
    int n = 1234;
    std::ostringstream os;
    os << "The number is " << n;
    MessageBox( 0, os.str().c_str(), 0, 0 );
}
true!

I guess I just am used to MFC/wx where you really don't need to deal with standard streams ever =x
ok thnx ;)
Topic archived. No new replies allowed.