Next: , Previous: bpipe_proc_def, Up: Utility Functions


A.4.21 bpipe_sprintf

Format a BPipe data field for output.

Synopsis

     #include <bpipe/bpipe.h>
     
     
     
int bpipe_sprintf( char *s, void *data, BPDataType type, char *formats[] );

Parameters

char *s
a buffer to hold the formatted output. it should be large enough to hold any output from any data type
void *data
a pointer to the data to be formatted
BPDataType type
the data's BPipe datatype code
          
          
Possible values for a BPDataType are as follows: BPDType_char, BPDType_double, BPDType_int, BPDType_uint, BPDType_DVector2, BPDType_DVector3, BPDType_IVector2, BPDType_IVector3, BPDType_UIVector2, BPDType_UIVector3, BPDType_DComplex, BPDType_DCVector2, BPDType_DCVector3
char *formats[]
an array of pointers to formats, with BPDType_num elements. These should be in the order of the enum's (see bpipe.h) The first element (corresponding to BPDType_NOTYPE, should contain an error message. If this argument is NULL, the default formats are used

Description

This routine will format a data field for output. It fills a user-provided array with characters representing the data, in much the same way that sprintf does. It uses default output formats for the various data types, which may be changed by providing a new array of output formats.

Returns

It returns the same value as does sprintf.