tfSPrintF

Jump to: navigation, search

Table of Contents >> Programmer's Reference


#include <trsocket.h>


int tfSPrintF (
char * buffer,
const char * format,
...
);


Function Description

This function writes formatted data to an array using the following format specifiers:


Examples:

Call Result
tfSPrintF(myBuffer, "This is example number %d", 1); "This is example number 1"
tfSPrintF(myBuffer, "This is %s number %d", "example", 2); "This is example number 2"


Format Specifiers:

Code Description
%c Print a character
%d Print a signed decimal integer
%e Scientific notation: prints a lower case e
%E Scientific notation: prints an upper case E
%f Decimal floating point
%g Choose between %e or %f depending on which is shorter
%G Choose between %E or %F depending on which is shorter
%i Print a signed decimal integer
%n The value to which %n corresponds is a pointer to a variable representing the number of characters successfully output
%o Print an unsigned octal
%p Show a pointer
%s Print a string (up to the first null character encountered)
%u Print an unsigned decimal integer
%x Print an unsigned hex integer (lowercase)
%X Print an unsigned hex integer (uppercase)
%% Print a percent sign


Parameters

  • buffer
    The string to be written.
  • format
    The string containing the format specifiers.


Returns

  • int
    A number representing the number of characters put into an array.


Table of Contents >> Programmer's Reference