the following "example.exe" C++ program:
int main(int argc, char *argv[]) { int number = 0; do { scanf("%d", &number); for(int x=1; x<=number; x++) { printf("%d n", x); } } while (number >= 1); return EXIT_SUCCESS; }
Code:
import subprocess, os PIPE = subprocess.PIPE p = subprocess.Popen("example.exe", stdin=PIPE, stdout=PIPE) p.stdin.write("10") p.stdin.flush() print p.stdout.read() #Deadlock print "End of Execution" os.system("PAUSE")
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
4 | [pyqt4]QTimer 예제 - 버튼을 누르면 3초후 함수 또는 메소드 호출 | makersweb | 2015.04.01 | 9824 |
3 | [PyQt4]폴더 또는 파일을 드레그하여 그 경로를 LineEdit로 가져오기 | pjk | 2014.08.22 | 13556 |
2 | [PyQt4]여러가지 버튼 예제 | pjk | 2014.08.29 | 13898 |
» | 외부 프로그램 실행 | pjk | 2015.02.10 | 15381 |