#include 

#define COMMAND(NAME)  { #NAME, NAME ## _command }

using namespace std;

struct command
{
	char *name;
	void (*function) (int r_nArg);
};

void quit_command(int r_nArg)
{
	cout << "quit_command " << r_nArg;
}

void help_command(int r_nArg)
{
	cout << "help_command " << r_nArg;
}

struct command commands1[] =
{
	{ "help", help_command },
	{ "quit", quit_command },
};

struct command commands2[] =
{
	COMMAND (help),
	COMMAND (quit),
};

int _tmain(int argc, _TCHAR* argv[])
{
	commands1[0].function(3000);

	return 0;
}
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2010/01/07 22:34 2010/01/07 22:34

트랙백 주소 :: http://anyons.net/tc/trackback/34

댓글을 달아 주세요