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 | 다른 디렉터리의 파일(모듈) import 하기 | pjk | 2014.08.22 | 8147 |
| 3 |
[PyQt4]윈도우창에 별 찍기 예제
| pjk | 2014.08.19 | 11676 |
| 2 |
Python으로 작성된 프로그램을 윈도우응용프로그램(exe)으로 빌드하기
| pjk | 2014.08.03 | 17136 |
| 1 | 파이썬으로 작성된 소스를 py2exe을 이용하여 윈도우 응용프로그램 빌드시 콘솔창 숨기기 | pjk | 2014.07.29 | 18027 |