本文整理汇总了C++中ParseData函数的典型用法代码示例。如果您正苦于以下问题:C++ ParseData函数的具体用法?C++ ParseData怎么用?C++ ParseData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ParseData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _T
BOOL CxNetCardInfo::GetInfo()
{
ErrMsg = _T("Success!");
BOOL isNormal = FALSE;
unsigned long nError;
nError = GetAdaptersInfo( pinfo,&len );
switch( nError ) {
case ERROR_SUCCESS:
isNormal = ParseData();
break;
case ERROR_NO_DATA:
ErrMsg = _T( "No net device information!" );
break;
case ERROR_NOT_SUPPORTED:
ErrMsg = _T( "The system not support GetAdaptersInfo API function!" );
break;
case ERROR_BUFFER_OVERFLOW:
nError = GetAdaptersInfo( pinfo,&len );
if( nError == 0 )
isNormal = ParseData();
else ErrMsg = _T("Unknow error!");
break;
}
return isNormal;
}
示例2: _T
void CNetCardInfo::GetInfo()
{
ErrMsg = _T( "Success!" );
unsigned long nError;
nError = GetAdaptersInfo( m_pinfo,&len );
switch( nError ) {
case ERROR_SUCCESS:
ParseData();
break;
case ERROR_NO_DATA:
ErrMsg = _T( "No net device information!" );
break;
case ERROR_NOT_SUPPORTED:
ErrMsg = _T( "The system not support GetAdaptersInfo API function!" );
break;
case ERROR_BUFFER_OVERFLOW:
nError = GetAdaptersInfo( m_pinfo,&len );
if( nError == 0 )
{
ParseData();
ParseMacAddressList();
}
else ErrMsg = _T("Unknow error!");
break;
}
}
示例3: DBCreate
/*
* Create an Database
*/
tDatabase DBCreate(const char * filename)
{
if(filename == NULL)
{
fprintf(stderr,"filename Error,%s:%d\n", __FILE__,__LINE__);
filename = "nezha.hdb";
}
/* connect server */
h = OpenRemoteService(IP_ADDR,PORT);
if(h == -1)
{
exit(-1);
}
/* open database file */
char Buf[MAX_BUF_LEN] = "\0";
int BufSize = MAX_BUF_LEN;
FormatData1(Buf,&BufSize,OPEN_CMD,(char*)filename,strlen(filename));
SendData(h,Buf,BufSize);
BufSize = MAX_BUF_LEN;
RecvData(h,Buf,&BufSize);
int cmd = -1;
int DataNum = -1;
char Data1[MAX_BUF_LEN] = "\0";
int Data1Size = MAX_BUF_LEN;
char Data2[MAX_BUF_LEN] = "\0";
int Data2Size = MAX_BUF_LEN;
ParseData(Buf,MAX_BUF_LEN,&cmd,&DataNum,Data1,&Data1Size,Data2,&Data2Size);
if(cmd != OPEN_RSP || DataNum != 0)
{
fprintf(stderr,"Remote DBCreate Error,%s:%d\n", __FILE__,__LINE__);
}
return (tDatabase)&h;
}
示例4: DBDelKeyValue
/*
* delete key/value
*/
int DBDelKeyValue(tDatabase db,tKey key)
{
if(db == NULL)
{
return -1;
}
char Buf[MAX_BUF_LEN] = "\0";
int BufSize = MAX_BUF_LEN;
int ret = FormatData1(Buf,&BufSize,DELETE_CMD,(char*)&key,sizeof(tKey));
if(ret == -1)
{
return -1;
}
SendData(*(tServiceHandler*)db,Buf,BufSize);
BufSize = MAX_BUF_LEN;
if(RecvData(*(tServiceHandler*)db,Buf,&BufSize) == 0)
{
fprintf(stderr,"Connection Error,%s:%d\n",__FILE__,__LINE__);
return -1;
}
int cmd = -1;
int DataNum = -1;
char Data1[MAX_BUF_LEN] = "\0";
int Data1Size = MAX_BUF_LEN;
char Data2[MAX_BUF_LEN] = "\0";
int Data2Size = MAX_BUF_LEN;
ParseData(Buf,BufSize,&cmd,&DataNum,Data1,&Data1Size,Data2,&Data2Size);
if(cmd == ERROR_RSP && DataNum == 1)
{
fprintf(stderr,"%s,%s:%d\n",Data1, __FILE__,__LINE__);
return -1;
}
return 0;
}
示例5: ReloadData
static Channel* ReloadData(void *Data)
{
DSBUFFERDESC dsBD;
BYTE * pbWaveData;
INT NumBytes;
// uint8 *data = NULL;
Channel* channel;
// if( !Name )
// return( NULL );
// if( !GetSoundData( Data, &data ) )
// return( NULL );
if( !ParseData( Data, &dsBD, &pbWaveData ) )
return( NULL );
NumBytes = dsBD.dwBufferBytes;
//Create the channel
// if( !CreateChannel( Name, &dsBD, &channel ) )
if( !CreateChannel(&dsBD, &channel ) )
return NULL;
//Fill the channel
if ( !DSFillSoundBuffer(channel->buffer, pbWaveData, NumBytes))
return NULL;
// geRam_Free(data);
// free( data );
return( channel );
}
示例6: CreateRemoteDB
/*
* Create an Database
*/
int CreateRemoteDB(char *addr, int port, const char * dbName)
{
if(dbName == NULL)
{
fprintf(stderr, "filename Error,%s:%d\n", __FILE__, __LINE__);
dbName = "default.hdb";
}
/* connect server */
tServiceHandler h = OpenRemoteService(addr, port);
if(h == -1)
{
return -1;
}
/* open database file */
char Buf[MAX_BUF_LEN] = "\0";
int BufSize = MAX_BUF_LEN;
FormatData1(Buf, &BufSize, OPEN_CMD, (char*)dbName, strlen(dbName));
SendData(h, Buf, BufSize);
BufSize = MAX_BUF_LEN;
RecvData(h, Buf, &BufSize);
int cmd = -1;
int DataNum = -1;
char Data1[MAX_BUF_LEN] = "\0";
int Data1Size = MAX_BUF_LEN;
char Data2[MAX_BUF_LEN] = "\0";
int Data2Size = MAX_BUF_LEN;
ParseData(Buf, MAX_BUF_LEN, &cmd, &DataNum, Data1, &Data1Size, Data2, &Data2Size);
if(cmd != OPEN_RSP || DataNum != 0)
{
fprintf(stderr, "CreateRemoteDB Error,%s:%d\n", __FILE__, __LINE__);
return -1;
}
return h;
}
示例7: ParseValue
/* IScanner */
static inline int ParseValue(struct IParse *parse, struct ISection *section)
{
ParseComment(parse);
ParseSkip(parse);
/* Value Name */
char name[MAX_NAME];
if (!ParseName(parse, name, MAX_NAME)) {
return 0;
}
ParseSkip(parse);
int code = ParsePeek(parse, 0);
if (!(code == '=')) {
return 0;
}
ParseRead(parse); /* = */
ParseSkip(parse);
/* Value Data */
char data[MAX_VALUE];
if (!ParseData(parse, data, MAX_VALUE)) {
return 0;
}
AddSectionString(section, name, data);
return 1;
}
示例8: sleep
void Daemon::ErrorStatus(){
// if entered in this loop for the first time
if ( !error_)
{
dataType errMex;
errMex.append((void*)"ERROR\0\0",6);
// send 3 error mex
connectionManager_->Send(errMex,CmdSck);
sleep(1);
connectionManager_->Send(errMex,CmdSck);
sleep(1);
connectionManager_->Send(errMex,CmdSck);
//Reset Members
if(eventBuilder_)eventBuilder_->Reset();
//hwManager_-> ???
if(hwManager_)
{
hwManager_->Clear(); // call reset of all board
//hwManager_->Config(*configurator_); //configure all boards -- ?
//hwManager_->Init(); // Init All Boards
}
}
error_=true;
//wait for instructions
dataType myMex;
if (connectionManager_->Recv(myMex) == 0 )
{
Command myCmd=ParseData(myMex) ;
if (myCmd.cmd == ENDRUN ){
error_=false;
MoveToStatus(INITIALIZED);
}
}
return;
}
示例9: memset
//从文件加载数据
bool CDataManageCenter::LoadDataFromFile(CString FilePath,vector<sShuangSeQiu>& QiuList)
{
DWORD Flag = OPEN_EXISTING;
HANDLE FileHandle=CreateFile(FilePath,GENERIC_WRITE|GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,Flag,FILE_ATTRIBUTE_NORMAL,NULL);
if(FileHandle == INVALID_HANDLE_VALUE)
return false;
DWORD Size = ::GetFileSize(FileHandle,NULL);
char* Buffer = new char[Size+1];
memset(Buffer,'\0',Size+1);
DWORD ReadBytes=0;
::ReadFile(FileHandle,Buffer,Size,&ReadBytes,NULL);
CString StrData=CString(Buffer);
ParseData(StrData,QiuList);
delete []Buffer;
//初始化横向差值
/* InitHengXiangChaZhi(m_ShuangSeQiuList);
//初始化纵向差值
InitZongXiangChaZhi(m_ShuangSeQiuList);
//初始化连号平码
InitLianHaoHongQiu(m_ShuangSeQiuList);
//初始化连号特码
InitLianHaoLanQiu(m_ShuangSeQiuList);
*/
return true;
}
示例10: fclose
bool P1MeterSerial::StartHardware()
{
#ifdef DEBUG_FROM_FILE
FILE *fIn=fopen("E:\\meter.txt","rb+");
BYTE buffer[1000];
int ret=fread((BYTE*)&buffer,1,sizeof(buffer),fIn);
fclose(fIn);
ParseData((const BYTE*)&buffer,ret);
#endif
m_stoprequested = false;
m_thread = boost::shared_ptr<boost::thread>(new boost::thread(boost::bind(&P1MeterSerial::Do_Work, this)));
//Try to open the Serial Port
try
{
_log.Log(LOG_STATUS,"P1 Smart Meter: Using serial port: %s", m_szSerialPort.c_str());
if (m_iBaudRate==9600)
{
open(
m_szSerialPort,
m_iBaudRate,
boost::asio::serial_port_base::parity(
boost::asio::serial_port_base::parity::even),
boost::asio::serial_port_base::character_size(7)
);
}
else
{
//DSMRv4
open(
m_szSerialPort,
m_iBaudRate,
boost::asio::serial_port_base::parity(
boost::asio::serial_port_base::parity::none),
boost::asio::serial_port_base::character_size(8)
);
}
}
catch (boost::exception & e)
{
_log.Log(LOG_ERROR,"P1 Smart Meter: Error opening serial port!");
#ifdef _DEBUG
_log.Log(LOG_ERROR,"-----------------\n%s\n-----------------",boost::diagnostic_information(e).c_str());
#else
(void)e;
#endif
return false;
}
catch ( ... )
{
_log.Log(LOG_ERROR,"P1 Smart Meter: Error opening serial port!!!");
return false;
}
m_bIsStarted=true;
m_linecount=0;
m_exclmarkfound=0;
setReadCallback(boost::bind(&P1MeterSerial::readCallback, this, _1, _2));
sOnConnected(this);
return true;
}
示例11: WSAGetLastError
void Socket::Recv()
{
if(connection == true)
{
fd_set read_fds = master;
if( select(s + 1, &read_fds, NULL, NULL, &tv) == -1)
{
int err = WSAGetLastError();
if(err == 0){}
else
{
MessageBox(0, "Function select() has failed!", "ERROR", MB_OK | MB_ICONERROR);
this->~Socket();
connection = false;
}
}
if(FD_ISSET(s, &read_fds)) // we got something
{
if((bytes = recv(s, (char*)Buffer, 1024, 0)) > 0)
{
Reader.SetBuffer((unsigned char*)Buffer);
ParseData(bytes);
}
else
{
SetText("**Connection lost...");
FD_CLR(s, &read_fds);
connection = false;
this->~Socket();
}
}
}
}
示例12: DBSetKeyValue
/*
* Set key/value
*/
int DBSetKeyValue(tDatabase db,tKey key,tValue value)
{
debug("SET_CMD:%d -> %s\n",key,value.str);
char Buf[MAX_BUF_LEN] = "\0";
int BufSize = MAX_BUF_LEN;
int ret = FormatData2(Buf,&BufSize,SET_CMD,(char*)&key,sizeof(tKey),value.str,value.len);
if(ret == -1)
{
return -1;
}
SendData(*(tServiceHandler*)db,Buf,BufSize);
BufSize = MAX_BUF_LEN;
if(RecvData(*(tServiceHandler*)db,Buf,&BufSize) == 0)
{
fprintf(stderr,"Connection Error,%s:%d\n",__FILE__,__LINE__);
return -1;
}
int cmd = -1;
int DataNum = -1;
char Data1[MAX_BUF_LEN] = "\0";
int Data1Size = MAX_BUF_LEN;
char Data2[MAX_BUF_LEN] = "\0";
int Data2Size = MAX_BUF_LEN;
ParseData(Buf,BufSize,&cmd,&DataNum,Data1,&Data1Size,Data2,&Data2Size);
if(cmd != SET_RSP || DataNum != 0)
{
fprintf(stderr,"Remote DBSetKeyValue Error,%s:%d\n", __FILE__,__LINE__);
return -1;
}
return 0;
}
示例13: RemoveClient
void SMOnlineRoom::UpdateClients() {
int length = 0;
for (unsigned int x = 0; x < m_clients.size(); ++x)
{
if (!m_clients[x])
{
LOG->Write("Error: Trying to update NULL client");
RemoveClient(x);
continue;
}
try
{
do
{
//As long as we keep getting data from the socket, keep processing it
length = m_clients[x]->Update(m_packet);
if (length > 0)
ParseData(m_packet, x);
//Check for NULL incase the client switched rooms
} while ((length > 0) && (x < m_clients.size()) && (m_clients[x]));
}
catch (ClientError&)
{
RemoveClient(x);
}
}
}
示例14: RemoteDBDelete
/*
* Delete the Database
*/
int RemoteDBDelete(int db)
{
/* close database file */
char Buf[MAX_BUF_LEN] = "\0";
int BufSize = MAX_BUF_LEN;
FormatData(Buf,&BufSize,CLOSE_CMD);
SendData(db,Buf,BufSize);
BufSize = MAX_BUF_LEN;
if(RecvData(db,Buf,&BufSize) == 0)
{
fprintf(stderr,"Connection Error,%s:%d\n",__FILE__,__LINE__);
return -1;
}
int cmd = -1;
int DataNum = -1;
char Data1[MAX_BUF_LEN] = "\0";
int Data1Size = MAX_BUF_LEN;
char Data2[MAX_BUF_LEN] = "\0";
int Data2Size = MAX_BUF_LEN;
ParseData(Buf,MAX_BUF_LEN,&cmd,&DataNum,Data1,&Data1Size,Data2,&Data2Size);
if(cmd != CLOSE_RSP || DataNum != 0)
{
fprintf(stderr,"Remote DBDelete Error,%s:%d\n", __FILE__,__LINE__);
return -1;
}
/* close connection */
if(CloseRemoteService(db) == -1)
{
return -1;
}
return 0;
}
示例15: RTPMemoryObject
RTCPCompoundPacket::RTCPCompoundPacket(RTPRawPacket &rawpack, RTPMemoryManager *mgr) : RTPMemoryObject(mgr)
{
compoundpacket = 0;
compoundpacketlength = 0;
error = 0;
if (rawpack.IsRTP())
{
error = ERR_RTP_RTCPCOMPOUND_INVALIDPACKET;
return;
}
uint8_t *data = rawpack.GetData();
size_t datalen = rawpack.GetDataLength();
error = ParseData(data,datalen);
if (error < 0)
return;
compoundpacket = rawpack.GetData();
compoundpacketlength = rawpack.GetDataLength();
deletepacket = true;
rawpack.ZeroData();
rtcppackit = rtcppacklist.begin();
}