Update main.c

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

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

Loading…
Cancel
Save

Powered by TurnKey Linux.