printf format specification for types....

i saw the format specification of  printf, but i don't know which type is for which ...  like %f is for float right?
i'm trying to use the string.format to be used in my sql statement...  i get the values from a table in a database...and these are the types that i get from odbc...
types when binded using odbc
    TEXT------------------------ text
    LONGTEXT-------------------- text
    Currency-------------------- text
    Long------------------------ long
    Counter--------------------- long
    Bit------------------------- Bool
    Datetime-------------------- DateTime
    LongBinary------------------ text

if float is %f ,  long is %_? or datatime is % ?  the string fomat is supposed to be the same as those of printf, it's supposed to convert the said types to string, i just don't know which letters to use...

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

kburns102197Connect With a Mentor Commented:
The following is the printf Formatting

% [flags] [width] [.precision] [{F | N | h | l | L}] type

The formats for the printf family of functions are listed below.

-      (left justify)
+      (prefix with sign)
blank      (prefix with blank)
#      (modifies o, x, X, e, E, f, g, G)
F      (far pointer)
N      (near pointer)
h      (short int)
l,L      (long int or double)
d,i      (signed decimal)
u      (unsigned decimal integer)
o      (unsigned octal integer)
x,X      (unsigned hex integer)
f      (fixed-point integer)
e, E      (scientific notation)
g, G      (%e or %f; whichever is shorter)
c      (single character)
s      (string)
p      (pointer)
n      (character count)

TEXT------------------------ text  -> use %s
LONGTEXT-------------------- text  -> use %s
currency-------------------- text  -> use %s
Long------------------------ long  -> use %ld
Counter--------------------- long  use %ld
Bit------------------------- Bool -> %d
Datetime-------------------- DateTime ? probably %s
LongBinary------------------ text -> use %s

char longtext[255];

printf("This is my longtext %s",longtest);
All Courses

From novice to tech pro — start learning today.