本文整理汇总了C++中CAr::Read方法的典型用法代码示例。如果您正苦于以下问题:C++ CAr::Read方法的具体用法?C++ CAr::Read怎么用?C++ CAr::Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAr
的用法示例。
在下文中一共展示了CAr::Read方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGameStartReceive
// 과금정보의 ACK
void CDPBilling::OnGameStartReceive( CAr & ar, DPID dpid )
{
char szAccount[MAX_ID_LENGTH];
char szTimeOverDays[13];
long lRemainDays;
long lResult;
ar >> lResult;
ar.Read( szAccount, MAX_ID_LENGTH );
ar >> lRemainDays;
ar.Read( szTimeOverDays, 12 );
szTimeOverDays[12] = '\0';
lResult = ntohl( lResult ); // 호스트 바이 오더로 변환한다.
lRemainDays = ntohl( lRemainDays );
// @flyff.jp가 붙은 유저 문자열에서 @flyff.jp를 제거한다
int i;
for( i=0; i<MAX_ID_LENGTH; ++i )
{
if( szAccount[i] == 0x20 )
break;
}
i -= ENDMARK_LENGTH; // ENDMARK_LENGTH = strlen("@flyff.jp");
szAccount[i] = '\0';
char szBuffer[1024];
sprintf(szBuffer, "recv 0x00010001 - GAME_START_RECEIVE\nstatus:%d user:%s remainday:%d enddate:%s\n",
lResult, szAccount, lRemainDays, szTimeOverDays );
OutputDebugString( szBuffer );
CTime tmOverDays = 0;
if( lResult == SUCCESS )
{
char sYear[3] = { 0, };
char sMonth[3] = { 0, };
char sDay[3] = { 0, };
char sHour[3] = { 0, };
char sMin[3] = { 0, };
strncpy( sYear, szTimeOverDays, 2 );
strncpy( sMonth, szTimeOverDays + 2, 2 );
strncpy( sDay, szTimeOverDays + 4, 2 );
strncpy( sHour, szTimeOverDays + 6, 2 );
strncpy( sMin, szTimeOverDays + 8, 2 );
tmOverDays = CTime( 2000 + atoi( sYear ), atoi( sMonth ), atoi( sDay ), 0, 0, 0 );
}
BILLING_INFO info;
info.szAccount = szAccount;
info.dwKey = 0;
info.lResult = lResult;
info.pTimeOverDays = &tmOverDays; // tmOverDays는 lResult가 SUCCESS인 경우에만 설정되면 된다.
g_AccountMng.SendBillingResult( &info );
}
示例2: Serialize
int CRTMessenger::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
ar << m_dwState;
ar << static_cast<int>( size() );
for( map<u_long, Friend>::iterator i = begin(); i != end(); ++i )
{
ar << i->first;
ar.Write( &i->second, sizeof(Friend) );
}
}
else
{
clear();
ar >> m_dwState;
int nSize;
ar >> nSize;
if( nSize > MAX_FRIEND )
return nSize;
u_long idFriend;
int i; for( i = 0; i < nSize; i++ )
{
ar >> idFriend;
Friend f;
ar.Read( &f, sizeof(Friend) );
SetFriend( idFriend, &f );
}
}
return 0;
}
示例3: Serialize
void CGuildWar::Serialize( CAr & ar )
{
if( ar.IsStoring() )
{
ar << m_idWar;
ar.Write( &m_Decl, sizeof(m_Decl) );
ar.Write( &m_Acpt, sizeof(m_Acpt) );
ar << m_nFlag;
ar << (time_t)m_time.GetTime();
}
else
{
ar >> m_idWar;
ar.Read( &m_Decl, sizeof(m_Decl) );
ar.Read( &m_Acpt, sizeof(m_Acpt) );
ar >> m_nFlag;
time_t time;
ar >> time;
m_time = CTime( time );
}
}