Initial commit

This commit is contained in:
CChen616
2024-03-19 15:48:17 +08:00
parent 2ae601ba66
commit 1023fb5796
82 changed files with 43002 additions and 1 deletions

19
src/MakerbaseShell.cpp Normal file
View 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);
}
}