{"id":411,"date":"2018-09-19T15:14:56","date_gmt":"2018-09-19T07:14:56","guid":{"rendered":"http:\/\/euhat.com\/wp\/?p=411"},"modified":"2018-09-19T15:14:56","modified_gmt":"2018-09-19T07:14:56","slug":"%e5%ae%89%e5%8d%93jni%e6%af%ab%e7%a7%92%e7%ba%a7%e6%89%93%e5%8d%b0","status":"publish","type":"post","link":"http:\/\/euhat.com\/wp\/2018\/09\/19\/%e5%ae%89%e5%8d%93jni%e6%af%ab%e7%a7%92%e7%ba%a7%e6%89%93%e5%8d%b0\/","title":{"rendered":"\u5b89\u5353jni\u6beb\u79d2\u7ea7\u6253\u5370"},"content":{"rendered":"<pre lang=\"cpp\" line=\"1\">\n#include <stdarg.h>\n#include <stdlib.h>\n#include <stdio.h>\n#include <string.h>\n#include <time.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <string>\n\nusing namespace std;\n\nvoid ivrLog(const char *format, ...)\n{\n\tva_list argptr;\n\tchar buf[1024 * 2];\n\n\tva_start(argptr, format);\n\tvsprintf(buf, format, argptr);\n\tva_end(argptr);\n\n\tstruct timeval tv;\n\tint iRet = gettimeofday(&tv, NULL);\n\ttime_t t = tv.tv_sec;\n\ttm* local = localtime(&t);\n\tchar timeBuf[256];\n\tstrftime(timeBuf, 254, \"[%Y-%m-%d %H:%M:%S\", local);\n\tsprintf(timeBuf + strlen(timeBuf), \":%d] \", (int)(tv.tv_usec \/ 1000));\n\tstring dispStr = timeBuf;\n\tdispStr += buf;\n\n\tprintf(\"%s\", dispStr.c_str());\n\n\t\/\/ please ensure \/sdcard\/Test dir existed first\n\tchar *logFileName = (char *)\"\/sdcard\/Test\/log.txt\";\n\n\tint fd = open(logFileName, O_CREAT|O_WRONLY|O_APPEND, 0666);\n\tif (fd != -1)\n\t{\n\t\twrite(fd, dispStr.c_str(), dispStr.length());\n\t\tclose(fd);\n\t}\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#include #include #include #include #include #include #include #include using namespace std; void ivrLog(const char *format, ...) { va_list argptr; char buf[1024 * 2]; va_start(argptr, format); vsprintf(buf, format, argptr); va_end(argptr); struct timeval tv; int iRet = gettimeofday(&#038;tv, NULL); time_t t = tv.tv_sec; tm* local = localtime(&#038;t); char timeBuf[256]; strftime(timeBuf, 254, \"[%Y-%m-%d %H:%M:%S\", local); sprintf(timeBuf + strlen(timeBuf), ... <a title=\"\u5b89\u5353jni\u6beb\u79d2\u7ea7\u6253\u5370\" class=\"read-more\" href=\"http:\/\/euhat.com\/wp\/2018\/09\/19\/%e5%ae%89%e5%8d%93jni%e6%af%ab%e7%a7%92%e7%ba%a7%e6%89%93%e5%8d%b0\/\" aria-label=\"More on \u5b89\u5353jni\u6beb\u79d2\u7ea7\u6253\u5370\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[141,390,413,447],"_links":{"self":[{"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/posts\/411"}],"collection":[{"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/comments?post=411"}],"version-history":[{"count":0,"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/posts\/411\/revisions"}],"wp:attachment":[{"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/media?parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/categories?post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/euhat.com\/wp\/wp-json\/wp\/v2\/tags?post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}