ngotl
07-21-2002, 03:29 AM
Does any one know there would be different output in the following 2 versions of the codes?The only difference is where I call IDISPLAY_DrawText() to display str1
Version 1:
str1 = NULL;
IDBRECORD_Reset(pIDBRecord);
fType = IDBRECORD_NextField(pIDBRecord, &fName, &len);
str1 = (AECHAR*)IDBRECORD_GetField(pIDBRecord , &fName, &fType, &len);
if(str1 == NULL)
{
return FALSE;
}
/***********following 2 lines are at the end in version 2****/
IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, str1 , -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_TOP);
dum = NULL;
// GET THE NEXT FIELD
if((fType=IDBRECORD_NextField(pIDBRecord, &fName, &len))==AEEDB_FT_NONE)
{
return FALSE;
}
dum = (AECHAR*)IDBRECORD_GetField(pIDBRecord, &fName, &fType, &len);
if(dum == NULL)
{
return FALSE;
}
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, dum, -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_BOTTOM);
IDISPLAY_Update(pMe->a.m_pIDisplay);
/***************************************************/
Version 2:
str1 = NULL;
IDBRECORD_Reset(pIDBRecord);
fType = IDBRECORD_NextField(pIDBRecord, &fName, &len);
str1 = (AECHAR*)IDBRECORD_GetField(pIDBRecord , &fName, &fType, &len);
if(str1 == NULL)
{
return FALSE;
}
dum = NULL;
// GET THE NEXT FIELD
if((fType=IDBRECORD_NextField(pIDBRecord, &fName, &len))==AEEDB_FT_NONE)
{
return FALSE;
}
dum = (AECHAR*)IDBRECORD_GetField(pIDBRecord, &fName, &fType, &len);
if(dum == NULL)
{
return FALSE;
}
/*********** These 2 lines were not here in version 1********/
IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, str1 , -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_TOP);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, dum, -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_BOTTOM);
IDISPLAY_Update(pMe->a.m_pIDisplay);
It turns out the output is different. for version 2, it is correctly output the 2 string of 2 fields but for version 2, str1 becomes the same string as str2 (str1 is assigned by str2)!!!???
I hope my uestion is not confusing, it maybe since i am also so confusing in the midle of the night. sigh. guess it's A good time to firget it.(2:30 am now). Thank you so so much for any help.
LN
:confused:
Version 1:
str1 = NULL;
IDBRECORD_Reset(pIDBRecord);
fType = IDBRECORD_NextField(pIDBRecord, &fName, &len);
str1 = (AECHAR*)IDBRECORD_GetField(pIDBRecord , &fName, &fType, &len);
if(str1 == NULL)
{
return FALSE;
}
/***********following 2 lines are at the end in version 2****/
IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, str1 , -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_TOP);
dum = NULL;
// GET THE NEXT FIELD
if((fType=IDBRECORD_NextField(pIDBRecord, &fName, &len))==AEEDB_FT_NONE)
{
return FALSE;
}
dum = (AECHAR*)IDBRECORD_GetField(pIDBRecord, &fName, &fType, &len);
if(dum == NULL)
{
return FALSE;
}
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, dum, -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_BOTTOM);
IDISPLAY_Update(pMe->a.m_pIDisplay);
/***************************************************/
Version 2:
str1 = NULL;
IDBRECORD_Reset(pIDBRecord);
fType = IDBRECORD_NextField(pIDBRecord, &fName, &len);
str1 = (AECHAR*)IDBRECORD_GetField(pIDBRecord , &fName, &fType, &len);
if(str1 == NULL)
{
return FALSE;
}
dum = NULL;
// GET THE NEXT FIELD
if((fType=IDBRECORD_NextField(pIDBRecord, &fName, &len))==AEEDB_FT_NONE)
{
return FALSE;
}
dum = (AECHAR*)IDBRECORD_GetField(pIDBRecord, &fName, &fType, &len);
if(dum == NULL)
{
return FALSE;
}
/*********** These 2 lines were not here in version 1********/
IDISPLAY_ClearScreen(pMe->a.m_pIDisplay);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, str1 , -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_TOP);
IDISPLAY_DrawText(pMe->a.m_pIDisplay, AEE_FONT_NORMAL, dum, -1, 0,100,0, IDF_ALIGN_CENTER | IDF_ALIGN_BOTTOM);
IDISPLAY_Update(pMe->a.m_pIDisplay);
It turns out the output is different. for version 2, it is correctly output the 2 string of 2 fields but for version 2, str1 becomes the same string as str2 (str1 is assigned by str2)!!!???
I hope my uestion is not confusing, it maybe since i am also so confusing in the midle of the night. sigh. guess it's A good time to firget it.(2:30 am now). Thank you so so much for any help.
LN
:confused: