raincom.cpp

来自「好用的键盘超人源代码」· C++ 代码 · 共 32 行

CPP
32
字号

#include "stdafx.h"
#include "raindoc.h"

//gobal variables here
int InitSocket;
CRainDoc *PDocument;

//gobal functions here
UINT MapRand(UINT max) 
{
    int arand=rand();
    float map=(float)max/RAND_MAX;
    float retVal=(float)arand*map+0.5f;
    return (UINT)retVal;   //return 0 - max	
}

CString localHostIP()
{
     struct hostent *h;
	 char hostName[100];
     struct in_addr addr;
     CString hostIP; 
			 
	 gethostname(hostName,100);
     h=gethostbyname(hostName);
	 memcpy(&addr, h->h_addr, sizeof(int));
     hostIP=inet_ntoa(addr);
	 
	 return hostIP;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?