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 | pydbus 바인딩을 이용하여 서비스 데몬과 D-Bus통신 | makersweb | 2018.03.12 | 2410 |
3 | 명령어 한줄로 내컴퓨터를 웹서버로 | 운영자 | 2019.01.25 | 3862 |
2 | Qt For Python(PySide2) QML 프로젝트 예제 | makersweb | 2019.10.17 | 5184 |
1 | pybind11 에 대해서 | makersweb | 2023.07.23 | 2914 |