Running GCC from within my program
Hello all. I am writing a program to be a sort of gcc/g++ frontend. OF course, to do this, i need to be able to run gcc and/or g++. I also need to be able to capture the output and the return value of it, so i can determine whether i have to show the user the errors, or whether it exited ok.
I don't know of any ways to capture the output, thats why I am asking, but i was thinking this: I could have it > to a file, and then read tha, if all else fails... Tell me what you think, if the other isn't a possibility. Thanks in advance.
~Inquirer
this is interesting... but annoying...
Everything works except this one part:
Code:
(newdecad@grex:~/prog)$ g++ -o epile epile.cpp
epile.cpp: In function `int main(int, char **)':
epile.cpp:85: implicit declaration of function `int pclose(...)'
Any ideas?
Code:
79: fGcc = popen( sCompileString, "r" );
80: if( fGcc ) {
81: iGccBufLine = 0;
82: while( fgets( sGccBuf[iGccBufLine], 128, fGcc ) ) {
83: printf( "%s", sGccBuf[iGccBufLine++] );
84: }
85: printf( "%d\n", pclose( fGcc ) );
86: }