mirror of
https://github.com/QIDITECH/QIDI_Q1_Pro.git
synced 2026-02-01 08:28:42 +03:00
Initial commit
This commit is contained in:
19
src/MakerbaseShell.cpp
Normal file
19
src/MakerbaseShell.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "../include/MakerbaseShell.h"
|
||||
|
||||
void execute_cmd(const char *cmd, char *result) {
|
||||
char buf_ps[MAX_FILE_LEN];
|
||||
char ps[MAX_FILE_LEN];
|
||||
FILE *ptr;
|
||||
strcpy(ps, cmd);
|
||||
if ((ptr = popen(ps, "r")) != NULL) {
|
||||
while (fgets(buf_ps, MAX_FILE_LEN, ptr) != NULL)
|
||||
{
|
||||
strcat(result, buf_ps);
|
||||
if (strlen(result) > MAX_FILE_LEN)
|
||||
break;
|
||||
}
|
||||
pclose(ptr);
|
||||
} else {
|
||||
printf("popen %s error\n", ps);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user