2017-12-07 18:06:19 -05:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
< meta http-equiv = "X-UA-Compatible" content = "IE=9" / >
2018-03-05 23:18:59 -05:00
< meta name = "generator" content = "Doxygen 1.8.8" / >
2017-12-07 18:06:19 -05:00
< title > json-c: json_util.h File Reference< / title >
< link href = "tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "jquery.js" > < / script >
< script type = "text/javascript" src = "dynsections.js" > < / script >
< link href = "doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
< tr style = "height: 56px;" >
2018-03-05 23:18:59 -05:00
< td style = "padding-left: 0.5em;" >
2017-12-07 18:06:19 -05:00
< div id = "projectname" > json-c
2018-03-05 23:18:59 -05:00
  < span id = "projectnumber" > 0.13.1< / span >
2017-12-07 18:06:19 -05:00
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2018-03-05 23:18:59 -05:00
<!-- Generated by Doxygen 1.8.8 -->
< div id = "navrow1" class = "tabs" >
< ul class = "tablist" >
< li > < a href = "index.html" > < span > Main  Page< / span > < / a > < / li >
< li > < a href = "pages.html" > < span > Related  Pages< / span > < / a > < / li >
< li > < a href = "annotated.html" > < span > Data  Structures< / span > < / a > < / li >
< li class = "current" > < a href = "files.html" > < span > Files< / span > < / a > < / li >
< / ul >
< / div >
< div id = "navrow2" class = "tabs2" >
< ul class = "tablist" >
< li > < a href = "files.html" > < span > File  List< / span > < / a > < / li >
< li > < a href = "globals.html" > < span > Globals< / span > < / a > < / li >
< / ul >
< / div >
2017-12-07 18:06:19 -05:00
< / div > <!-- top -->
< div class = "header" >
< div class = "summary" >
< a href = "#define-members" > Macros< / a > |
< a href = "#func-members" > Functions< / a > < / div >
< div class = "headertitle" >
< div class = "title" > json_util.h File Reference< / div > < / div >
< / div > <!-- header -->
< div class = "contents" >
< p > Miscllaneous utility functions and macros.
< a href = "#details" > More...< / a > < / p >
< table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "define-members" > < / a >
Macros< / h2 > < / td > < / tr >
2018-03-05 23:18:59 -05:00
< tr class = "memitem:a3dde282dc23d0eaa3c4840df8dc262d4" > < td class = "memItemLeft" align = "right" valign = "top" > #define  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a3dde282dc23d0eaa3c4840df8dc262d4" > json_min< / a > (a, b)      ((a) < (b) ? (a) : (b))< / td > < / tr >
2017-12-07 18:06:19 -05:00
< tr class = "separator:a3dde282dc23d0eaa3c4840df8dc262d4" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
2018-03-05 23:18:59 -05:00
< tr class = "memitem:a57d63d199d4b9ea40359253618951300" > < td class = "memItemLeft" align = "right" valign = "top" > #define  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a57d63d199d4b9ea40359253618951300" > json_max< / a > (a, b)      ((a) > (b) ? (a) : (b))< / td > < / tr >
2017-12-07 18:06:19 -05:00
< tr class = "separator:a57d63d199d4b9ea40359253618951300" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a084b6afc8f7fbef88976aabe4aca7efd" > < td class = "memItemLeft" align = "right" valign = "top" > #define  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a084b6afc8f7fbef88976aabe4aca7efd" > JSON_FILE_BUF_SIZE< / a >       4096< / td > < / tr >
< tr class = "separator:a084b6afc8f7fbef88976aabe4aca7efd" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table > < table class = "memberdecls" >
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a name = "func-members" > < / a >
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:a8fa0bba6b7ddb149a2159d99bae709ce" > < td class = "memItemLeft" align = "right" valign = "top" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a8fa0bba6b7ddb149a2159d99bae709ce" > json_object_from_file< / a > (const char *filename)< / td > < / tr >
< tr class = "separator:a8fa0bba6b7ddb149a2159d99bae709ce" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a62ba7e0f43eb72c418654acf4e263aa6" > < td class = "memItemLeft" align = "right" valign = "top" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a62ba7e0f43eb72c418654acf4e263aa6" > json_object_from_fd< / a > (int fd)< / td > < / tr >
< tr class = "separator:a62ba7e0f43eb72c418654acf4e263aa6" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:abbd121df84ec3878a5cb8fefaff12ec7" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#abbd121df84ec3878a5cb8fefaff12ec7" > json_object_to_file< / a > (const char *filename, struct < a class = "el" href = "structjson__object.html" > json_object< / a > *obj)< / td > < / tr >
< tr class = "separator:abbd121df84ec3878a5cb8fefaff12ec7" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a4e980954930951bf790c1ec3ba68fb76" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a4e980954930951bf790c1ec3ba68fb76" > json_object_to_file_ext< / a > (const char *filename, struct < a class = "el" href = "structjson__object.html" > json_object< / a > *obj, int flags)< / td > < / tr >
< tr class = "separator:a4e980954930951bf790c1ec3ba68fb76" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:adc52c3b220effc880270f095cd748433" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#adc52c3b220effc880270f095cd748433" > json_object_to_fd< / a > (int fd, struct < a class = "el" href = "structjson__object.html" > json_object< / a > *obj, int flags)< / td > < / tr >
< tr class = "separator:adc52c3b220effc880270f095cd748433" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a811b1a5a7544337811a44c26fbe88761" > < td class = "memItemLeft" align = "right" valign = "top" > const char *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a811b1a5a7544337811a44c26fbe88761" > json_util_get_last_err< / a > (void)< / td > < / tr >
< tr class = "separator:a811b1a5a7544337811a44c26fbe88761" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a9bb9882ef2859ca2c1ee17805679bc25" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a9bb9882ef2859ca2c1ee17805679bc25" > json_parse_int64< / a > (const char *buf, int64_t *retval)< / td > < / tr >
< tr class = "separator:a9bb9882ef2859ca2c1ee17805679bc25" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a6b5790c15178b6ea97841fc5868b1e1a" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a6b5790c15178b6ea97841fc5868b1e1a" > json_parse_double< / a > (const char *buf, double *retval)< / td > < / tr >
< tr class = "separator:a6b5790c15178b6ea97841fc5868b1e1a" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:a74031a1b948dc9fed3f367ea6ce78389" > < td class = "memItemLeft" align = "right" valign = "top" > const char *  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "json__util_8h.html#a74031a1b948dc9fed3f367ea6ce78389" > json_type_to_name< / a > (enum < a class = "el" href = "json__object_8h.html#ac75c61993722a9b8aaa44704072ec06c" > json_type< / a > o_type)< / td > < / tr >
< tr class = "separator:a74031a1b948dc9fed3f367ea6ce78389" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
< div class = "textblock" > < p > Miscllaneous utility functions and macros. < / p >
< / div > < h2 class = "groupheader" > Macro Definition Documentation< / h2 >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a084b6afc8f7fbef88976aabe4aca7efd" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > #define JSON_FILE_BUF_SIZE      4096< / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a57d63d199d4b9ea40359253618951300" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > #define json_max< / td >
< td > (< / td >
< td class = "paramtype" >   < / td >
< td class = "paramname" > a, < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" >   < / td >
< td class = "paramname" > b  < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td >       ((a) > (b) ? (a) : (b))< / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a3dde282dc23d0eaa3c4840df8dc262d4" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > #define json_min< / td >
< td > (< / td >
< td class = "paramtype" >   < / td >
< td class = "paramname" > a, < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" >   < / td >
< td class = "paramname" > b  < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td >       ((a) < (b) ? (a) : (b))< / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< / div >
< / div >
< h2 class = "groupheader" > Function Documentation< / h2 >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a62ba7e0f43eb72c418654acf4e263aa6" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > * json_object_from_fd < / td >
< td > (< / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > fd< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Create a JSON object from already opened file descriptor.< / p >
< p > This function can be helpful, when you opened the file already, e.g. when you have a temp file. Note, that the fd must be readable at the actual position, i.e. use lseek(fd, 0, SEEK_SET) before.< / p >
< p > Returns -1 if something fails. See < a class = "el" href = "json__util_8h.html#a811b1a5a7544337811a44c26fbe88761" > json_util_get_last_err()< / a > for details. < / p >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a8fa0bba6b7ddb149a2159d99bae709ce" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > * json_object_from_file < / td >
< td > (< / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > filename< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Read the full contents of the given file, then convert it to a < a class = "el" href = "structjson__object.html" > json_object< / a > using < a class = "el" href = "json__tokener_8h.html#a236ef64d079822a4411d13eae7190c4d" > json_tokener_parse()< / a > .< / p >
< p > Returns -1 if something fails. See < a class = "el" href = "json__util_8h.html#a811b1a5a7544337811a44c26fbe88761" > json_util_get_last_err()< / a > for details. < / p >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "adc52c3b220effc880270f095cd748433" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int json_object_to_fd < / td >
< td > (< / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > fd< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > *  < / td >
< td class = "paramname" > < em > obj< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > flags< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Convert the < a class = "el" href = "structjson__object.html" > json_object< / a > to a string and write it to the file descriptor. Handles partial writes and will keep writing until done, or an error occurs.< / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > fd< / td > < td > an open, writable file descriptor to write to < / td > < / tr >
< tr > < td class = "paramname" > obj< / td > < td > the object to serializer and write < / td > < / tr >
< tr > < td class = "paramname" > flags< / td > < td > flags to pass to < a class = "el" href = "json__object_8h.html#a9db613127bd4ef7db42307e43a85fc1b" > json_object_to_json_string_ext()< / a > < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > -1 if something fails. See < a class = "el" href = "json__util_8h.html#a811b1a5a7544337811a44c26fbe88761" > json_util_get_last_err()< / a > for details. < / dd > < / dl >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "abbd121df84ec3878a5cb8fefaff12ec7" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int json_object_to_file < / td >
< td > (< / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > filename< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > *  < / td >
< td class = "paramname" > < em > obj< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Equivalent to: json_object_to_file_ext(filename, obj, JSON_C_TO_STRING_PLAIN);< / p >
< p > Returns -1 if something fails. See < a class = "el" href = "json__util_8h.html#a811b1a5a7544337811a44c26fbe88761" > json_util_get_last_err()< / a > for details. < / p >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a4e980954930951bf790c1ec3ba68fb76" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int json_object_to_file_ext < / td >
< td > (< / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > filename< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > struct < a class = "el" href = "structjson__object.html" > json_object< / a > *  < / td >
< td class = "paramname" > < em > obj< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > flags< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Open and truncate the given file, creating it if necessary, then convert the < a class = "el" href = "structjson__object.html" > json_object< / a > to a string and write it to the file.< / p >
< p > Returns -1 if something fails. See < a class = "el" href = "json__util_8h.html#a811b1a5a7544337811a44c26fbe88761" > json_util_get_last_err()< / a > for details. < / p >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a6b5790c15178b6ea97841fc5868b1e1a" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int json_parse_double < / td >
< td > (< / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > buf< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > double *  < / td >
< td class = "paramname" > < em > retval< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a9bb9882ef2859ca2c1ee17805679bc25" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int json_parse_int64 < / td >
< td > (< / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > buf< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > int64_t *  < / td >
< td class = "paramname" > < em > retval< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a74031a1b948dc9fed3f367ea6ce78389" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > const char* json_type_to_name < / td >
< td > (< / td >
< td class = "paramtype" > enum < a class = "el" href = "json__object_8h.html#ac75c61993722a9b8aaa44704072ec06c" > json_type< / a >   < / td >
< td class = "paramname" > < em > o_type< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Return a string describing the type of the object. e.g. "int", or "object", etc... < / p >
< / div >
< / div >
2018-03-05 23:18:59 -05:00
< a class = "anchor" id = "a811b1a5a7544337811a44c26fbe88761" > < / a >
2017-12-07 18:06:19 -05:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > const char* json_util_get_last_err < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Return the last error from various json-c functions, including: json_object_to_file{,< em > ext}, < a class = "el" href = "json__util_8h.html#adc52c3b220effc880270f095cd748433" > json_object_to_fd()< / a > or json_object_from< / em > {file,fd}, or NULL if there is none. < / p >
< / div >
< / div >
< / div > <!-- contents -->
<!-- start footer part -->
< hr class = "footer" / > < address class = "footer" > < small >
2018-03-05 23:18:59 -05:00
Generated on Mon Mar 5 2018 23:17:09 for json-c by   < a href = "http://www.doxygen.org/index.html" >
2017-12-07 18:06:19 -05:00
< img class = "footer" src = "doxygen.png" alt = "doxygen" / >
2018-03-05 23:18:59 -05:00
< / a > 1.8.8
2017-12-07 18:06:19 -05:00
< / small > < / address >
< / body >
< / html >