J
jitu.csewizard
hi
overview:
function sprintf(<buffername>,<format string>, .....)
in this function you need to allocate the size of buffername before
hand.
question:
function ssprintf(<buffername>,<format string>, .....)
i need to write a funtion in time and space optimized way so that i
should allocate buffername after getting the string.(ignore the time of
mallocing the memory...there is a different strategy for mallocing...it
won't take much time)
i have thought of a strategy:
1. writing the format string to /dev/null or to memory and get the
length of the string and then again malloc(not exactly malloc ....there
is a different optimized strategy) the required string.
problem: a call to printf takes time if the string is long
note:calling string functions like strlen also takes time.
can you suggest me a better optimized strategy.
overview:
function sprintf(<buffername>,<format string>, .....)
in this function you need to allocate the size of buffername before
hand.
question:
function ssprintf(<buffername>,<format string>, .....)
i need to write a funtion in time and space optimized way so that i
should allocate buffername after getting the string.(ignore the time of
mallocing the memory...there is a different strategy for mallocing...it
won't take much time)
i have thought of a strategy:
1. writing the format string to /dev/null or to memory and get the
length of the string and then again malloc(not exactly malloc ....there
is a different optimized strategy) the required string.
problem: a call to printf takes time if the string is long
note:calling string functions like strlen also takes time.
can you suggest me a better optimized strategy.