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 | 명령어 한줄로 내컴퓨터를 웹서버로 | 운영자 | 2019.01.25 | 3773 |
3 | 우분투에 Python새 버전 설치 사용법 | pjk | 2015.02.10 | 3334 |
2 | pybind11 에 대해서 | makersweb | 2023.07.23 | 2654 |
1 | pydbus 바인딩을 이용하여 서비스 데몬과 D-Bus통신 | makersweb | 2018.03.12 | 2328 |