Hi All,
I have this piece of C code. Any idea of why it uses a bitwise shift ('<<' at the bottom of this note)? The file contains hexidecimal records... The wvar seems to be 1 char/int returned to the calling routine. Is it some way to identify the bytes on the record to return?
I'm supposed to be maintaining this code so I suppose it'd be a good idea to understand it..
Thanks,
Sean
void HandleCommonRecord(BYTE bType)
{
struct EffISDNEstruct stInternal;
memset(&stInternal,0,sizeof(stInternal));
ReadTL3Word(stAppInst.fInFile,&stInternal.wRecSize);
}
void ReadTL3Word(FILE *iFile,WORD *wVar)
{
BYTE bHigh = 0,bLow = 0;
fread(&bHigh,1,1,iFile);
fread(&bLow,1,1,iFile);
*wVar = bLow + (bHigh << 8);
}
I have this piece of C code. Any idea of why it uses a bitwise shift ('<<' at the bottom of this note)? The file contains hexidecimal records... The wvar seems to be 1 char/int returned to the calling routine. Is it some way to identify the bytes on the record to return?
I'm supposed to be maintaining this code so I suppose it'd be a good idea to understand it..
Thanks,
Sean
void HandleCommonRecord(BYTE bType)
{
struct EffISDNEstruct stInternal;
memset(&stInternal,0,sizeof(stInternal));
ReadTL3Word(stAppInst.fInFile,&stInternal.wRecSize);
}
void ReadTL3Word(FILE *iFile,WORD *wVar)
{
BYTE bHigh = 0,bLow = 0;
fread(&bHigh,1,1,iFile);
fread(&bLow,1,1,iFile);
*wVar = bLow + (bHigh << 8);
}