int fCount = 0;
char frameNum[7];
sprintf(frameNum, %06u", fCount);
int fCount = 0;
char frameNum[6];
sprintf(frameNum, %06u", fCount);
Q1. Which is correct, 6 or 7?
Q2. I am using VC6 and the file is sample.cpp.
I think sprintf is C. Is there a better way?
I need the char string right justified and with padded zeros.
Please don’t tell me to use a newer compiler. I need to use VC6 for now.
First one is correct. There is no memory leak, by the way.
—
Yes. C++ way: