串口日志保留进文件中

串口日志保留进文件中

sample:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char **argv)
{
    static FILE *pFile = NULL;
    char *acBuf = "ctest some code";
    printf("strlen = %d acBuf = %s\n", strlen(acBuf), acBuf);
    if (pFile == NULL) {
        pFile = fopen("/tmp/x.txt", "wb");
    }
    if (pFile != NULL) {
        fwrite(acBuf, sizeof(char), strlen(acBuf), pFile);
        fwrite("\n", 1, 1, pFile);
        fflush(pFile);
    }

}
上一篇:你知道大量群发邮件用什么邮箱好吗?


下一篇:managed-schema配置文件详解