Is there a way I can prevent the console from opening when I use popen or would I have to do that in the program I am opening?
Prevent console open on popen?
Collapse
X
-
Tags: None
-
-
A PHP viewer type deal. Not really to sure how to explain it but basically:
We type PHP source on one side of the application and hit a button then the other side displays the output.
If you need/want to see the program its here ( do note PHP must be installed and on the path ) compiled on windows.
When I execute the code the PHP console opens and closes.Comment
-
Command line is "php FILE".
Function is _popen/fputs not sure which one you meant.
Windows is fine I'm sure I can find the linux way.
Code:void HPreview::updatePage( ) { FILE *fp1 = fopen( "source", "w" ); fputs( this->input->toPlainText( ).toStdString( ).c_str( ), fp1 ); fclose( fp1 ); char buffer[1024]; QString output( "" ); long length; FILE *fp = _popen( "php source", "r" ); while( fgets( buffer, sizeof( buffer ), fp ) != NULL ) { output.append( buffer ); } fclose( fp ); this->output->setHtml( output ); }
Comment
-
You may have to do some experimentation but I think you could achieve what you want using CreateProcess. But you would have to create your own pipe for stdin/stdout first.Comment
-
Comment