[En-Nut-Discussion] Who can answer me on sprintf problem ?

ivesworking ivesworking at hotmail.com
Sun Jul 9 00:22:09 CEST 2006


I was apply this a lot of sprintf technic on theboard, till on old 3.4 OS,
i know this should be more like gcc question,

i processing some word on cgi,
to avoid declare too many buffer using malloc, i thinking of declare one 
large block of mem as buffer
then using sprintf to add content into it, (due to the content i want will 
be in format, so sprintf is a good tools )

however sprintf will wipe out the original content, as strcpy do,
so i program with
sprintf(buffer,"%shelloworld %d %d ", buffer, data1,data2);
i able to perform this task without complain from the compiler and it was 
running on the board fine,
to avoid future problem, i need someone confirm with me this method is 
usable in standard gcc which compiler know how to handle this kind of 
technic, or this is technically not allow due to it point back to the same 
place,


Wfloh 



More information about the En-Nut-Discussion mailing list