Reputation: 1869
I'm trying to subtract a substring from params->filename
and append it to query.
I would prefer to avoid extra copying it (params->filename won't change after i exec sprintf , isin't it)?
This is what I tried:
(gdb) print params->filename
$4 = 0x8b7d53 "20140317.080051.std"
....
sprintf (query+strlen(query), " %.*s ', to_date('YYYYMMDD.HHMISS')", 0, params->filename+ 15);
It doesn't attach anything. Any clue?
Upvotes: 0
Views: 59
Reputation: 141554
With %.*s
, the argument corresponding to *
means the number of characters to write. You gave argument 0
so it writes 0
characters.
To fix this, either change the 0
to a positive number, or if you want to write the remainder of the string you can just omit the .*
and the 0,
.
Upvotes: 3