yyjson_mut_val_write_file

Function yyjson_mut_val_write_file 

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

Write a value to JSON file with options.

This function is thread-safe when:

  1. The file is not accessed by other threads.
  2. The val 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 val The mutable JSON root value. If this parameter is NULL, the function will fail and return NULL. @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.