Initializing help system before first use

# bindrv_newwriter

Purpose
Create a new BinDrv context for writing to an output stream.
Synopsis
`s_bindrvctx bindrv_newwriter(size_t (*dowrite)(const void *,size_t,size_t,void*), void *rctx);`
Arguments

dowrite | Callback function to write data to the output stream
rctx | File descriptor to be passed as the last argument of dowrite

Return value
The new context or NULL in case of error.
Example
In the following example the file "bindata is open using C-function fopen and a writer is created based on the resulting file descriptor:

    f=fopen("bindata", "w");
    bdrv=bindrv_newwriter(
           (size_t (*)(const void *,size_t,size_t,void*))fwrite, f);

Further information
1. Each context created using this function must be released by a call to bindrv_delete.
2. The dowrite function is used by the writer whenever it needs to write data. The function receives as input a buffer, its size and, as the last argument, the pointer rctx. The third argument is always 1. The return value must be 1 if successful, any other value is interpreted as an error condition.
3. The required dowrite routine has the same signature as the C-function fwrite such that a BinDrv writer can use as input a file open with the C-function fopen.
Related topics
bindrv_delete.
Parent Topic Writer

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.