src/lib/ppc405lib/sprintf.c
// snprintf() requires that bytes that won't fit in the array are simply
// discarded, but still accounted for. Note that vfprintf() is doing the
// high-level accounting.
snprintf() requires that bytes that won't fit in the array are simply
discarded, but still accounted for. Note that vfprintf() is doing the
high-level accounting.
snprintf () requires that bytes that won ' t fit in the array are simply discarded but still accounted for . Note that vfprintf () is doing the high - level accounting .
static int 
snprintf_swrite(FILE *stream, const void *buf, size_t size, size_t *written)
{
    StringStream *string = (StringStream *)stream;
    size_t to_write = MIN(size, string->size - string->next_write - 1);
    memcpy((void *)(&(string->data[string->next_write])), buf, to_write);
    string->next_write += to_write;
    *written = size;
    return 0;
}
static int snprintf_swrite ( FILE * stream , const void * buf , size_t size , size_t * written ) { StringStream * string = ( StringStream * ) stream ; size_t to_write = MIN ( size , string -> size - string -> next_write - 1 ) ; memcpy ( ( void * ) ( & ( string -> data [ string -> next_write ] ) ) , buf , to_write ) ; string -> next_write += to_write ; * written = size ; return 0 ; }
snprintf() requires that bytes that won't fit in the array are simply
discarded, but still accounted for.
snprintf () requires that bytes that won ' t fit in the array are simply discarded but still accounted for .