📄 glb_funcpp.cpp
字号:
// Glb_Var_Fun.cpp : implementation file
//
#include "stdafx.h"
#include "receiver.h"
#include "glb_fun.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//在ListBox中显示信息
void Show_msg_ListBox(char *msg)
{
CReceiverApp* pApp=(CReceiverApp*)AfxGetApp();
pApp->m_pRevListBox->InsertString(-1,msg);
}
//加入代码
//接收信息
//地址
int ReceiverMsg(char *msg)
{
int n;
n = sizeof(channelreceiver_addr);
return(n=recvfrom(receiver_sockfd, msg, MAX_MSG_SIZE, 0, (struct sockaddr *) &channelreceiver_addr, &n));
}
//加入代码
//发送信息
int SendMsg(char *msg,int len)
{
int n;
n = sizeof(channelreceiver_addr);
return(sendto(receiver_sockfd, msg, len, 0, (struct sockaddr *) &channelreceiver_addr, n));
}
//加入代码
//检查校验位
BOOL check_data(char *msg)
{
char b;
b=msg[2];
int count=0,i;
char a=0x01;
for(i=0;i<8;i++)
{
if(b&a)count++;
b=b>>1;
}
if(msg[3]==(count%2))return 1;
else return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -