现在知道用GetCommandLine()可以获得所有的参数但是如何将一个一个的参数放到数组里面供查询使用呢?就行argv和argc一样MSDN里面说可以用CommandLineToArgvW
但是这个函数不能用于非Unicode字符集,我的程序需在98下运行请大家帮忙,谢谢了

解决方案 »

  1.   

    Q How can I parse the command line in an MFC app? My program has several command line options (such as -l, -x, -help). I see there's m_lpCmdLine that points to the command line, but do I have to parse it myself? It seems like there should be some way to make CCommandLineInfo do it, but I can't figure out how. 、
    http://www.microsoft.com/msj/1099/c/c1099.aspx
      

  2.   

    sscanf函数可以取出空格分隔的字符串。例子看msdn.