JZsdk_FileSystm.c 1.0 KB
#include <stdio.h>
#include "JZsdk_FileSystm.h"
#include <stdlib.h>
#include <stdbool.h>
/*
*       用于运行指令
*
*/
int JZsdk_RunSystemCmd(char *systemCmd)
{
    //FILE *fp;

    //printf("JZsdk_RunSystemCmd:%s\n",systemCmd);

    // fp = popen(systemCmd, "r");
    // if (fp == NULL) {
    //     return -1;
    // }

    int status = system(systemCmd);
    if (status == -1 || WIFEXITED(status) == false) {
        printf("Call %s error, status = %d\n", systemCmd, status);
        return -1;
    }

    if (WEXITSTATUS(status) == 0) {
        printf("指令执行成功%s\n",systemCmd);
        return 0;
    } else {
        printf("Exit status is = %d", WEXITSTATUS(status));
        return -2;
    }
    //pclose(fp);

    return 0;
}

/*

    运行命令 并读取返回值

*/
// FILE* JZsdk_RunSystemCmd_ReturnFilePointer(char *systemCmd)
// {
//     FILE *fp;

//     fp = popen(systemCmd, "r");

//     pclose(fp);

//     return fp;
// }


int JZsdk_Socket()
{
    
}