Hi all,
I know that this may not be the correct forum, but I thought I would give it a shot....
I have a snipet of C code I need a little translation on. I only know a small amount of C or ++ so I am kind of stuck. I understand that there are some values assigned in the code that you cant see because it is missing, but I am hoping that you can do you best. My main focus is what occurs with the sprintf call. Any help at all would be greatly appreciated. Here is the code:
void IS_NewPalletNumber( char PalletNumber[] )
{
int PalletSeed;
static char GrafTable[] = "0123456789ABCDEFGHJKLPQRTUVYX#";
if ( LogSettings.PalletNumber >= IS_MaxPalletNumber ) {
LogSettings.PalletNumber = 0;
}/*if*/
PalletSeed = LogSettings.PalletNumber;
/* Keep the pallet numbers unique between 10 machines */
PalletSeed += ((MachineNumber-1) * 2000);
sprintf( PalletNumber,"%c%03d",
GrafTable[10+(PalletSeed/1000)], PalletSeed % 1000 );
LogSettings.PalletNumber++;
}/* IS_NewPalletNumber */
Thanks again,
Bill
I know that this may not be the correct forum, but I thought I would give it a shot....
I have a snipet of C code I need a little translation on. I only know a small amount of C or ++ so I am kind of stuck. I understand that there are some values assigned in the code that you cant see because it is missing, but I am hoping that you can do you best. My main focus is what occurs with the sprintf call. Any help at all would be greatly appreciated. Here is the code:
void IS_NewPalletNumber( char PalletNumber[] )
{
int PalletSeed;
static char GrafTable[] = "0123456789ABCDEFGHJKLPQRTUVYX#";
if ( LogSettings.PalletNumber >= IS_MaxPalletNumber ) {
LogSettings.PalletNumber = 0;
}/*if*/
PalletSeed = LogSettings.PalletNumber;
/* Keep the pallet numbers unique between 10 machines */
PalletSeed += ((MachineNumber-1) * 2000);
sprintf( PalletNumber,"%c%03d",
GrafTable[10+(PalletSeed/1000)], PalletSeed % 1000 );
LogSettings.PalletNumber++;
}/* IS_NewPalletNumber */
Thanks again,
Bill