Hi,
I'm using sprintf to add leading zeros to the left of variable, but looks like it's adding spaces instead of zeros. The same works on AIX.
//here is code snippet.
char act[10]="12345";
char act1[10];
sprintf(act1, "%010s",act );
sprintf("the value of second array '%s'\n",act1);
Program output : ' 12345'
expected result : '0000012345'
thanks,
Manju.
I'm using sprintf to add leading zeros to the left of variable, but looks like it's adding spaces instead of zeros. The same works on AIX.
//here is code snippet.
char act[10]="12345";
char act1[10];
sprintf(act1, "%010s",act );
sprintf("the value of second array '%s'\n",act1);
Program output : ' 12345'
expected result : '0000012345'
thanks,
Manju.
Comment