-
sprintf(len+id ?
Hi,
I'm trying to translate some C code to java and trying to understand some code so I could write it. Now I'm not a C expert, so don't laugh at me ;)
I'm trying to figure out what the line below does:
Code:
sprintf(id + len,"%08x",(uint32_t)(timems & 0xffffffff));
Where 'id' is u_char and 'len' is integer. Does he copy the resulting char array to id[len] or something ?
-
You basically got the idea.
id is the output string. It seems the author wanted that output to start at the 'len'th character in that array.
-
Yes, he wants to start at id[len], such as
'id' might be: "abcdefghijk\0"
And 'len' might be 4, so he wants to start at 'e'. Of course abcde... have been placed there as a visual aid.