   win32 command-line parsing
  How do ya do it?... Ive been googling for a while now but I have yet to find a really nitty-gritty basic tutorial that teaches a clear path to this.All I know is that you have to somehow parse lpCmdLine from the main procedure.  How to do this though is beyond me. 
  Dear god... someone please help me.  I am a first year computer science student and thus highly prone to hissy-fits. ;  Well the lpCmdLine is just a pointer to the command string so you just have to parse the string. That is copy every word from it and test them to valid commands or whatever you want to use them.;  Search for CommandLineToArgvW on msdn.microsoft.com, that should help get you started especially if you have written some unix or console programs. ;  And here's a function I use to get the next word from a string.It copies the word to word from the buffer and returns the length of the copyed word. int ParseNextWord(char *buffer,char *word){ int lcount = 0,i = 0; char ch;/* First skip the spaces*/while(buffer[lcount] ==' ') lcount++;   /* Next copy until space,newline,0 */    while((ch = buffer[lcount]) != '\n'&& ch != ' ' && ch != '\0')    {    word[i] = ch;    lcount++; i++;    }word[i] = 0;   /* return length of the copied word */return lcount;} [edited by - Atm97fin on February 6, 2004 4:58:01 PM];  Alright.  Call me a question-whore, but everywhere I look I find these tutorials with these ginormous command-line parser classes that seem fairly complex (for my understanding).  But it is just something as simple as what you said? ;  I'm not sure if there's a function to tokenize strings. If there was, all you'd have to do is to create an array of string pointers, and go through the command line and tokenize everything into seperate array elements. If there isn't, then use a loop:int index = 0;int currtoken = 0;char current;current = lpCmdLine[index];char *tokens[];getnexttoken:while ( current != ' ' ){    tokens[currtoken][index] = current;    index++;    if ( index < strlen( lpCmdLine ) )    {   current = lpCmdLine[index];    }    else    {   // Exit   goto exit;    }}currtoken++;index = 0;goto getnexttoken;exit:// Parse your tokensIf I did all that right, you should have an array full of tokenized strings.Now, you can use this array to whatever purpose you want.Ah, well, it seems Atm97fin has beat me to this function... [edited by - fyhuang on February 6, 2004 5:01:32 PM];  Thanks Atm97fin and fyhuang.I''ll hack around with her and see if I can make her talk. ;  I finally got it to work for me.  Did something a lil-bit different though. int clParse(char cLine[10]){for(int loop = 0; loop < 10; loop++){switch(cLine[loop]){case '-':{switch(cLine[loop + 1]){case 'm':MessageBox(NULL,"test",    "test",MB_OK | MB_ICONINFORMATION);break;}}}}return 1;} It works at least...   [edited by - Comatose Red on February 6, 2004 5:42:56 PM];quote:Original post by comatose red  I finally got it to work for me.  Did something a lil-bit different though. int clParse(char cLine[10]){for(int loop = 0; loop < 10; loop++){switch(cLine[loop]){case ''-'':{switch(cLine[loop + 1]){case ''m'':MessageBox(NULL,"test",    "test",MB_OK | MB_ICONINFORMATION);break;}}}}return 1;} It works at least...   [edited by - Comatose Red on February 6, 2004 5:42:56 PM]Seems to work, but if you write for example "app plim-m" you still get the test messagebox even when you typed wrong.Or it seems like that for the first look.