third_party/inchi/INCHI_BASE/src/ichi_io.c
int inchi_strbuf_printf( INCHI_IOS_STRING *buf, const char* lpszFormat, ... )
{
    int ret = 0, max_len;
    va_list argList;

    if (!buf)
    {
        return -1;
    }

    my_va_start( argList, lpszFormat );
    max_len = GetMaxPrintfLength( lpszFormat, argList );
    va_end( argList );
    if (max_len < 0)
    {
        return 0;
    }

    inchi_strbuf_update( buf, max_len );

    my_va_start( argList, lpszFormat );
    ret = vsprintf( buf->pStr + buf->nUsedLength, lpszFormat, argList );
    va_end( argList );
    if (ret >= 0)
    {
        buf->nUsedLength += ret;
    }

    return ret;
}
/****************************************************************************
 Add to the end of string in INCHI_IOS_STRING object,
    expanding buffer if necessary
****************************************************************************/
Add to the end of string in INCHI_IOS_STRING object,
expanding buffer if necessary
Add to the end of string in INCHI_IOS_STRING object expanding buffer if necessary
int inchi_strbuf_printf( INCHI_IOS_STRING *buf, const char* lpszFormat, ... )
{
    int ret = 0, max_len;
    va_list argList;
    if (!buf)
    {
        return -1;
    }
    my_va_start( argList, lpszFormat );
    max_len = GetMaxPrintfLength( lpszFormat, argList );
    va_end( argList );
    if (max_len < 0)
    {
        return 0;
    }
    inchi_strbuf_update( buf, max_len );
    my_va_start( argList, lpszFormat );
    ret = vsprintf( buf->pStr + buf->nUsedLength, lpszFormat, argList );
    va_end( argList );
    if (ret >= 0)
    {
        buf->nUsedLength += ret;
    }
    return ret;
}
int inchi_strbuf_printf ( INCHI_IOS_STRING * buf , const char * lpszFormat , ... ) { int ret = 0 , max_len ; va_list argList ; if ( ! buf ) { return -1 ; } my_va_start ( argList , lpszFormat ) ; max_len = GetMaxPrintfLength ( lpszFormat , argList ) ; va_end ( argList ) ; if ( max_len < 0 ) { return 0 ; } inchi_strbuf_update ( buf , max_len ) ; my_va_start ( argList , lpszFormat ) ; ret = vsprintf ( buf -> pStr + buf -> nUsedLength , lpszFormat , argList ) ; va_end ( argList ) ; if ( ret >= 0 ) { buf -> nUsedLength += ret ; } return ret ; }
Add to the end of string in INCHI_IOS_STRING object,
expanding buffer if necessary
Add to the end of string in INCHI_IOS_STRING object expanding buffer if necessary