#include <windows.h>
static void GetCurrentPath(char *PathName)
{
char *p,*q;
GetModuleFileName(NULL,PathName,256);
q = PathName;
do
{
p = q+1;
q = strstr(p,"\\");
} while (q);
if (p) *p = 0;
p = strstr(PathName,":");
if (p)
{
if (p - PathName > 1)
{
q = PathName;
p--;
do
{
*q++ = *p++;
} while(*p != 0);
*q = 0;
}
}
}
int GetIni()
{
char szFileName[MAX_PATH]={0};
char serverIp[20]={0};
int port;
GetCurrentPath(szFileName);
strcat(szFileName,"SOCKET.ini");//读取配置文件
GetPrivateProfileString("UDP","UDP_IP","127.0.0.1",serverIp,255,szFileName);
port = GetPrivateProfileInt("UDP","UDP_IP",5525,szFileName);
return 0;
}