PDA

View Full Version : Passing arguments to compiler



aaditya190
18th December 2013, 09:56
Is it possible to pass arguments to the gcc compiler from a gui app? e.g some text from a textedit to the compiler. Can anyone suggest some way to do this?

anda_skoa
18th December 2013, 10:26
For arguments see the QStringList argument of QProcess::start()

For content you have to check if the target exectuable can read from stdin or if it needs a file. In the first case see QProcess:write(), in the second case see QTemporayFile

Cheers,
_

aaditya190
18th December 2013, 10:28
@anda_skoa, Can you please help me with some code? I am relatively new to Qt....

stampede
18th December 2013, 11:41
Start here (http://qt-project.org/doc/qt-5.0/qtcore/qprocess.html#details), check the "Running a Process" section, there is an example included.