TheObserver
Programmer
I have a need to copy an integer (up to three digits) into a char buffer. The resultant field in the char buffer needs to be zero padded (IE 001 if the int is less than 10, 010 if the int is less than 100, and 100 if the int is 100 or greater).
I realize I can probably do a memset to get the 0's into the memory locations. I am mainly just wondering how to get the int into the buffer. I've thought about memcpy, etc, but I just want to make sure that that's the right way to go.
Thanks for your time.
I realize I can probably do a memset to get the 0's into the memory locations. I am mainly just wondering how to get the int into the buffer. I've thought about memcpy, etc, but I just want to make sure that that's the right way to go.
Thanks for your time.