yyjson_mut_write_file

Function yyjson_mut_write_file 

Source
pub unsafe extern "C" fn yyjson_mut_write_file(
    path: *const c_char,
    doc: *const yyjson_mut_doc,
    flg: yyjson_write_flag,
    alc: *const yyjson_alc,
    err: *mut yyjson_write_err,
) -> bool
Expand description

Write a document to JSON file with options.

This function is thread-safe when:

  1. The file is not accessed by other threads.
  2. The doc is not modified by other threads.
  3. 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 false. If this file is not empty, the content will be discarded. @param doc The mutable JSON document. If this doc is NULL or has no root, the function will fail and return false. @param flg The JSON write options. Multiple options can be combined with | operator. 0 means no options. @param alc The memory allocator used by JSON writer. 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 true if successful, false if an error occurs.

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