dSPACEツールの使い方を日本語で

interactive python using subprocess

Python script

import subprocess
from subprocess import Popen, PIPE, STDOUT
import time

cmd2_2 = 'askbirthmonth2.exe'

the_directory = "C:/MinGW/msys/1.0/home/****"
p = Popen(cmd2_2.split(), shell=True, stdin=PIPE, cwd = the_directory,stdout=PIPE)
print p.stdout.readline()
time.sleep(3)
p.stdin.write("10\n")
print p.stdout.readline()

C program for command prompt
#include

int main(void)
{
int birthmonth;
printf("what is your birth month?\n");
fflush(stdout);
scanf("%d", &birthmonth);
printf("your birth month is %d.\n",birthmonth);
return 0;
}

Popular Posts

About Me

Weizen Beer A dSPACE user

Icons made by Toast from www.flaticon.com is licensed by CC 3.0 BY

Blog Archive

Labels

Labels

Recent Comments

Recent Post

Video Of Day

Recent

Ad Banner

Popular Posts