谁有getopt的标准实现,给一份,谢谢

解决方案 »

  1.   

    你说的应该是命令行解析的吧?
    我有.
    已经上传,下载链接如下:
    http://adong2008.512j.com/temp/getopt.rar
      

  2.   

    #ifndef HAVE_GETOPT
    int
    getopt (argc, argv, optstring)
         int argc;
         char *const *argv;
         const char *optstring;
    {
      return _getopt_internal (argc, argv, optstring,
       (const struct option *) 0,
       (int *) 0,
       0);
    }
    #endif_getopt_internal 比较长,就不贴了
    标准如是说
    /* Getopt for GNU.
       NOTE: getopt is now part of the C library, so if you don't know what
       "Keep this file name-space clean" means, talk to [email protected]
       before changing it!
      

  3.   

    这个代码我有,可是不知道optstring怎么解释,怎么提供,还有如果参数为多个字符的好像不行吧
    比如: -f file -rv welcome -gb gb2312rv gb好像不能正确认识吧?
    如果可以,请告诉上面的参数,我在optstring中应该填充什么
      

  4.   

    不知道你那有没有getopt_long或getopt_long_only
    有个option结构数组用来传长参数