📄 main.cpp
字号:
////////////////////////////////////////////////////////////////////////// Filename : main.cpp// Written By : reiot@ewestsoft.com// Description : 霸烙 辑滚侩 皋牢 窃荐////////////////////////////////////////////////////////////////////////// include files#include "Types.h"#include "Exception.h"#include "GameServer.h"#include "LogClient.h"#include "Properties.h"#include "StringStream.h"#include <unistd.h>#include <stdlib.h>#include <sys/time.h>#include <sys/resource.h>#include <new>#include <stdexcept>#include <stdio.h>void handleMemoryError(){ cerr << "==============================================================================" << endl; cerr << "CRITICAL ERROR! NOT ENOUGH MEMORY!" << endl; cerr << "==============================================================================" << endl; filelog("CriticalError.log", "CRITICAL ERROR! NOT ENOUGH MEMORY!"); abort();}void handleUnhandledException(){ cerr << "==============================================================================" << endl; cerr << "UNHANDLED EXCEPTION OCCURED" << endl; cerr << "==============================================================================" << endl; filelog("CriticalError.log", "UNHANDLED EXCEPTION OCCURED"); abort();}void handleUnexpectedException(){ cerr << "==============================================================================" << endl; cerr << "UNEXPECTED EXCEPTION OCCURED" << endl; cerr << "==============================================================================" << endl; filelog("CriticalError.log", "UNEXPECTED EXCEPTION OCCURED"); abort();}void testMaxMemory(){ long mem = 10*1024*1024; // 10M char str[80]; for (int i=1; i<2048; i++) { char* p = new char [mem]; sprintf(str, "0x%08X = %04d0 M", p, i); cout << str << endl; }}////////////////////////////////////////////////////////////////////////// main()////////////////////////////////////////////////////////////////////////int main (int argc , char* argv[]){ cout << ">>> STARTING GAME SERVER..." << endl; filelog("serverStart.log", "GameServer Start"); // 阿辆 勤甸矾甫 汲沥茄促. std::set_new_handler(handleMemoryError); std::set_terminate(handleUnhandledException); std::set_unexpected(handleUnexpectedException); /* int* pPointer = NULL; pPointer = new int[10000000]; delete [] pPointer; */ // 利例茄 困摹甫 茫酒焊磊. srand(time(0)); cout << ">>> RANDOMIZATION INITIALIZATION SUCCESS..." << endl; if (argc < 3) { //cout << "Usage : gameserver -f 券版颇老" << endl; exit(1); } // command-line parameter甫 string 栏肺 函券茄促. ^^; string* Argv; Argv = new string[argc]; for (int i = 0 ; i < argc ; i ++) Argv[i] = argv[i]; cout << ">>> COMMAND-LINE PARAMETER READING SUCCESS..." << endl; // 券版 颇老阑 佬绢甸牢促. // 窜 角青 颇老篮 $VSHOME/bin俊, 券版 颇老篮 $VSHOME/conf 俊 粮犁秦具 茄促.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -