|
As you will see in the following function, we have a global struct pointer "g" and it has an element dbAcctNum which is a char array.
/* Pad Account number with Leading Zeroes */
void put_leading_zeroes(short j) { char save[50]; short i;
//Save Current String memset(save, ' ',sizeof(save)); memcpy(save,&g->dbAcctNum,sizeof(save));
// Put Leading zeroes memset(&g->dbAcctNum, ' ',sizeof(g->dbAcctNum)); for(i=0; i<(MAX_ACCOUNT_LEN - j); i++) { g->dbAcctNum[i] = '0'; } memcpy(&g->dbAcctNum[i], save, j); }
|