Zero Padding to a string

I am writing a C program which a part of it needs to padding zero in front of a string. The program will get a sting from an ASCII file which the maxium length of this string is 5 char long. The string can sometimes less the 5 char long. In order to make it with the same length '0's are being pad in front ot the string.

e.g. if the string from the ASCII file is '123 ' then 2 '0's will be needed in front which will make it look like this '00123'

Can someone help me with that...... I am totally new to C programming. I think for someone with a little bit C language experience it should be quit strict forward, or is it.

Thanks
Vincent

This isn't the most efficient approach, but it is easy to code:

char input[6], work[11], final[6];
fgets(input, 6, stdin);
strcpy(work, "00000");
strcat(work, input);
strcpy(final, &work[strlen(work)-6]);
printf(string = %s \n", final);

Or, here's a simpler way:

sprintf(final, "%.06d", num);    /*   'num' is assumed to be of type int   */
sprintf(final, "%.06d", atoi(num));    /*   'num' is assumed to be of type 'char *'    */

Thanks guys, I will try both of methods.