Output Redirect ( c++ compiler output to Irrlicht GUI )

Discussion about everything. New games, 3d math, development tips...
Post Reply
Alberto Rubinato

Output Redirect ( c++ compiler output to Irrlicht GUI )

Post by Alberto Rubinato »

Hi, I'm developing a framework ( GDK ) similar to Game Maker, but with Irrlicht for the graphic part and GUI. I would like to add a feature in order to make possible lunching c++ compiler within the project editor, but I don't know how to redirect the compiler output to a string for presenting it in a Irrlicht GUI widget.

I think that the command for execute external program would be system(program_name), but I'm not sure this is the unic or correct way.

Some days ago I watched to the source code of CODE-BLOCK ide, but I don't get the solution. That project is complex to analyze, and find the correct piece of code that make what I want to do is not simple. I'm not sure wath I could search......

Is possible to do something like this ( syntax errors excluded )?

var_string = cout << system(program_name);

Many thanks for help.

Alberto Rubinato
Guest

Post by Guest »

you can use ShellAPI,

ShellExecute(blah, blah blah ....

the last argument you can run the program hidden, as background, the second is arguments i think, the first is the program location... Its probably most useful, there are ways to represent the compilers output, search around, if there wasn't, how would the IDE's do it. heh.
Guest

Post by Guest »

oh, and no its not possible, i mean, it doesn't make since to do that. cout is the routine that displays text to the prompt. and to put it in a string variable wouldn't make much since at all. You probably would be better reading about c++... before starting on such a difficult project. Im not trying to offend, but I'm just saying it is going to be crazy difficult going at a project like this. as matter of fact i do beleive this has been tried by many people, and often died off.. good luck either way.
hybrid

Post by hybrid »

There are no ANSI-C++ conforming ways to access output of exec'd calls. So you have to make a workaround and redirect this to a file or pipe and read from that. Shouldn't be too hard to implement, but searching for portable and tested available implementations is always good!
zenaku
Posts: 212
Joined: Tue Jun 07, 2005 11:23 pm

Post by zenaku »

Under windows, don't use system(). Use ShellExecute(). The first parameter is an HWND of a window that you want the output to go to. You can then create a hidden window to put the output in and read the text out of there.

var_string = cout << system(program_name)
It's going to be a little more involved than that ;)
Post Reply