i have a script that takes c++ source code from an HTML textbox ( written by user )
and pass it to php and this php code writes the source code to a *.cpp file
and then usuing exec() i compile that .cpp
the problem is when i use exec() on any program it captures the output and put it in an array

exec("help.exe",$array);

and this array will hold the lines displayed
but when i use exec() on mingw32-g++ it doesnt store the output in the array no matter what i do
what are the limitations for exec or system to store the output ??
i made two programs to output string "hello world" using cout and printf and both work fine and the php stores the output "hello world"

can anyone help PLEASE

    well, when compiling an app with g++ isn't there supposed to be no output if the program compiled fine

      yes
      but if thers an error it should display each error on a different line

      like this :

      mingw32-g++ output: {ERROR GOES HERE}

      but it doesnt ... it doesnt capture any output at all

        Aren't error messages directed to stderr instead of stdout? Maybe tacking "2>1" on the end of the commandline to redirect stderr back to stdout would help?

          yeah weed is right, exec wont pick up whats sent to stdout since thats immediately flushed, and the compiler sends those errors to stderr.

            but its not always error messages
            its just any output either that compilation failed or compilation results
            you guys know mingw32 ??

            and can you elaborate the "2>1" part ?

              hi everyone on the earth i just want to say how are you on earth because i am herer hahahah

                Write a Reply...