这篇教程C++ GetCommand函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCommand函数的具体用法?C++ GetCommand怎么用?C++ GetCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetCommand函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: RunScriptvoid RunScript(){ char pstrCommand[MAX_COMMAD_SIZE]; char pstrStringParam[MAX_PARAM_SIZE]; for (g_iCurrScriptLine=0; g_iCurrScriptLine < g_iScriptSize; g_iCurrScriptLine++) { g_iCurrentLineChar = 0; GetCommand(pstrCommand); if (strcmp(pstrCommand, COMMAND_PRINTSTRING) == 0) { GetStringParam(pstrStringParam); printf("/t%s/n", pstrStringParam); } else if (strcmp(pstrCommand, COMMAND_PRINTSTRINGLOOP) == 0) { GetStringParam(pstrStringParam); int iLoopCount = GetIntParam(); for (int i=0; i < iLoopCount; i++) printf("/t%d: %s/n", i, pstrStringParam); } else if (strcmp(pstrCommand, COMMAND_NEWLINE) == 0) { printf("/n"); } else { printf("/tError: Invalid Command./n"); break; } }}
开发者ID:Who828,项目名称:command-based-language,代码行数:38,
示例2: assertbool CRegisteredCommands::AddCommand(CLuaMain* pLuaMain, const char* szKey, const CLuaFunctionRef& iLuaFunction, bool bRestricted, bool bCaseSensitive){ assert(pLuaMain); assert(szKey); // Check if we already have this key and handler SCommand* pCommand = GetCommand(szKey, pLuaMain); if (pCommand && iLuaFunction == pCommand->iLuaFunction) return false; // Create the entry pCommand = new SCommand; pCommand->pLuaMain = pLuaMain; pCommand->strKey.AssignLeft(szKey, MAX_REGISTERED_COMMAND_LENGTH); pCommand->iLuaFunction = iLuaFunction; pCommand->bRestricted = bRestricted; pCommand->bCaseSensitive = bCaseSensitive; // Add it to our list m_Commands.push_back(pCommand); return true;}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:24,
示例3: GetCommandBOOL Cx179App::InitInstance(){ CWinApp::InitInstance(); CString cmd = GetCommand(); OutputDebugStringA(cmd); //cmd = L"xxx caihong 123456 room 100001"; if(cmd.Find("caihong") >= 0) { ProcessCaihongCmd(cmd); return TRUE; } if(cmd.Find("://") > 0) { ProcessWebCmd(cmd); return TRUE; } return TRUE;}
开发者ID:mengskysama,项目名称:V8,代码行数:24,
示例4: GetMailcapEntryintGetMailcapEntry(FILE *fp)/* Parse a mailcap entry * On entry- * fp=mailcap file being read * If a valid mailcap entry is found then on exit- * GetMailcapEntry=1 * mc holds the decoded entry * Else on exit- * GetMailcapEntry=0 * The content of mc is undefined ***/{ int rawentryalloc = 2000, len; char *rawentry, *s, *t, *LineBuf; LineBuf = malloc(LINE_BUF_SIZE); if (!LineBuf) ExitWithError(nomem); rawentry = malloc(1 + rawentryalloc); if (!rawentry) ExitWithError(nomem); *rawentry = 0; while (fgets(LineBuf, LINE_BUF_SIZE, fp)) { if (LineBuf[0] == '#') continue; len = strlen(LineBuf); if (len == 0) continue; if (LineBuf[len-1] == '/n') LineBuf[--len] = 0; if ((len + strlen(rawentry)) > rawentryalloc) { rawentryalloc += 2000; rawentry = realloc(rawentry, rawentryalloc+1); if (!rawentry) ExitWithError(nomem); } if (LineBuf[len-1] == '//') { LineBuf[len-1] = 0; strcat(rawentry, LineBuf); } else { strcat(rawentry, LineBuf); break; } } free(LineBuf); for (s=rawentry; *s && isspace((unsigned char) *s); ++s) ; if (!*s) { /* totally blank entry -- quietly ignore */ free(rawentry); return(0); } s = index(rawentry, ';'); if (!s) { /* ignore invalid entries unless debugging */ if (DoDebug) fprintf(stderr, "Invalid mailcap entry: %s/n", rawentry); free(rawentry); return(0); } *s++ = 0; /* Terminate the content type and point to the remainder */ mc.needsterminal = 0; mc.copiousoutput = 0; mc.testcommand = NULL; mc.label = NULL; mc.printcommand = NULL; StripTrailingSpace(rawentry); mc.contenttype = malloc(1+strlen(rawentry)); if (!mc.contenttype) ExitWithError(nomem); strcpy(mc.contenttype, rawentry); t = GetCommand(s, &mc.command); if (!t) { /* There are no parameters */ free(rawentry); return(1); } s = t; while (s) { char *arg, *eq; t = GetCommand(s, &arg); eq = index(arg, '='); if (eq) *eq++ = 0; if (*arg) { arg = Cleanse(arg); if (!strcmp(arg, "needsterminal")) { mc.needsterminal = 1; } else if (!strcmp(arg, "copiousoutput")) { mc.copiousoutput = 1; } else if (eq && !strcmp(arg, "test")) { mc.testcommand = eq; } else if (eq && !strcmp(arg, "description")) { mc.label = eq; } else if (eq && !strcmp(arg, "label")) { mc.label = eq; /* bogus old name for description */ } else if (eq && !strcmp(arg, "print")) { mc.printcommand = eq; } else if (eq && !strcmp(arg, "textualnewlines")) { /* ExceptionalNewline(mc.contenttype, atoi(eq)); */ } else if (strcmp(arg, "notes")) { /* IGNORE notes field */ } else if (*arg && DoDebug) { fprintf(stderr, "ignoring mailcap flag: %s/n", arg); } } s = t; } free(rawentry);//.........这里部分代码省略.........
开发者ID:LukeMeszar,项目名称:CAS,代码行数:101,
示例5: c_mainvoid c_main(){ int i; bool autoboot=true; char cmd[128]; long timeout; int argc=0; char *argv[MAX_ARGS]; CMD_TBL *cptr; // initiate status. status.terminalSpeed = SERIAL_SPEED; status.downloadSpeed = SERIAL_DOWNLOAD_SPEED; /* initiate serial and timer */ // serial and timer init. SerialInit(status.terminalSpeed); printf("/n/nFFUART has been initiated"); TimerInit(); //// printf the required GPL string. ////////////////////////////////////// printf("/n/n"); //printf(" "PACKAGE "-" VERSION "/n Copyright 2005 Embedded Group at [email C++ GetCommandLineA函数代码示例 C++ GetCommTimeouts函数代码示例
|