changed to popen w

pull/78/head
alanbjohnston 5 years ago committed by GitHub
parent 36706a6c81
commit 1d2f100c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -344,28 +344,28 @@ int main(int argc, char * argv[]) {
strcat(pythonConfigStr, " c");
char cmdbuffer[1000];
/*
// FILE* file1 = popen("python3 /home/pi/CubeSatSim/python/voltcurrent.py 1 11 c", "r");
FILE * file1 = popen(pythonConfigStr, "r");
FILE * file1 = popen(pythonConfigStr, "w");
fgets(cmdbuffer, 1000, file1);
printf("pythonStr result: %s\n", cmdbuffer);
pclose(file1);
*/
int pid, infd, outfd;
printf("Start Process Result: %d %d %d %d \n", start_subprocess(pythonConfigStr, &pid, &infd, &outfd), pid, infd, outfd);
fgets(cmdbuffer, 1000, (FILE *)outfd);
printf("pythonStr result: %s\n", cmdbuffer);
// pclose(file1);
// int pid, infd, outfd;
// printf("Start Process Result: %d %d %d %d \n", start_subprocess(pythonConfigStr, &pid, &infd, &outfd), pid, infd, outfd);
// fgets(cmdbuffer, 1000, (FILE *)outfd);
// printf("pythonStr result: %s\n", cmdbuffer);
sleep(5);
fputc('\n', (FILE *)infd);
fgets(cmdbuffer, 1000, (FILE *)outfd);
fputc('\n', file1);
fgets(cmdbuffer, 1000, file1);
printf("pythonStr result2: %s\n", cmdbuffer);
sleep(5);
fputc('\n', (FILE *)infd);
fgets(cmdbuffer, 1000, (FILE *)outfd);
fputc('\n', file1);
fgets(cmdbuffer, 1000, file1);
printf("pythonStr result2: %s\n", cmdbuffer);

Loading…
Cancel
Save

Powered by TurnKey Linux.