# C/C++ IDE in Python



## abhijangda (Jan 1, 2011)

Hello friends, for some time I have been working on an IDE for C/C++ written in Python. Finally, I was able to develop it with help of PyQt4, but still one thing is remaining. Can anyone of you please tell me, how can I integrate GCC or G++ compiler in my program. By integration I mean, how can I compile, run and displays errors in program code, when user clicks Run button. Just like we have in other IDEs. I am working on Fedora 14. Please tell me how to do that. Even if you just have a small hint please do tell that. Thanks in advance!!


----------



## Liverpool_fan (Jan 1, 2011)

System Call?


```
import os
r = os.system("gcc filename.c > /tmp/output")
f = open("/tmp/output")
```
Using a combination of redirection should work well.
That f contains link to the file which contains the output.

For outputting you can create a process running xterm which will run a bash script which executes the file, and then use read such that it waits for user's input before exiting.

Though I doubt it's the best way to be very honest.

This will be immensely useful I think

17.1. subprocess ? Subprocess management &mdash; Python v2.7.1 documentation


----------



## abhijangda (Jan 2, 2011)

Thx for reply, i will try when i will come back to my home.


----------

