MFC下读取 ini文件的数值 (GetCurrentDirectory, GetPrivateProfileInt )

1.文件名:

Server.ini

2.文件内容

[RoomSet]
//游戏人数设置
PlayerCount=2
//客户端底分显示
ShowBaseScore=0


3.读取配置文件信息

TCHAR szPath[MAX_PATH] = TEXT("");
GetCurrentDirectory(sizeof(szPath), szPath);
TCHAR szFileName[MAX_PATH] = {0};
_sntprintf(szFileName, sizeof(szFileName), TEXT("%s\\Server.ini"), szPath);
int  playCount = (WORD)GetPrivateProfileInt(_T("RoomSet"), _T("PlayerCount"), GAME_PLAYER, szFileName);










猜你喜欢

转载自blog.csdn.net/chuanyu/article/details/53009194