1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
char temp[12];
size_t l;
sprintf( buffer, "%d", value );
memset(temp,' ',12)
l=strlen(buffer);
memcpy(temp+12-l,buffer,l);
/*
Note: you may need to change a few constants above if the interface requires the
buffer to be null-terminated.
*/
for (size_t a=0;a<12;a++)
buffer[11-a]=temp[a];
/*
Now, for an input of 123, buffer will contain
{'3','2','1',' ',' ',' ',' ',' ',' ',' ',' ',' '}
*/
| |