#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
static char* get_checkitems(void)
{
        FILE* checkitem_json = fopen("./kydoctor-common/checkitem.josn", "r");
        if (checkitem_json == NULL)
        {
                syslog(LOG_ERR, "Failed to opencheckitem.josn.");
                return NULL;
        }
        char* buffer = (char*)malloc(10240);
        char line[1024];
        while (fgets(line, 1024, checkitem_json) != NULL)
        {
                int len = strlen(line);
                line[len - 1] = 0;
                strcat(buffer, line);
                memset(line, 0, 1024);
        }
        return buffer;
}



int main()
{
        char* buf = get_checkitems();
        printf("len = %ld\n %s\n",strlen(buf), buf);
        return 0;
}