yyjson_read_file

Function yyjson_read_file 

Source
pub unsafe extern "C" fn yyjson_read_file(
    path: *const c_char,
    flg: yyjson_read_flag,
    alc: *const yyjson_alc,
    err: *mut yyjson_read_err,
) -> *mut yyjson_doc
Expand description

Read a JSON file.

This function is thread-safe when:

  1. The file is not modified by other threads.
  2. The alc is thread-safe or NULL.

@param path The JSON file’s path. If this path is NULL or invalid, the function will fail and return NULL. @param flg The JSON read options. Multiple options can be combined with | operator. 0 means no options. @param alc The memory allocator used by JSON reader. Pass NULL to use the libc’s default allocator. @param err A pointer to receive error information. Pass NULL if you don’t need error information. @return A new JSON document, or NULL if an error occurs. When it’s no longer needed, it should be freed with yyjson_doc_free().

@warning On 32-bit operating system, files larger than 2GB may fail to read.