VC ++中的getopt()

时间:2009-02-12 21:56:43

标签: c++ windows visual-studio-2008

Linux 下进行编程时,我非常喜欢使用GNU getopt。据我所知,getopt()在MS VC ++下不可用。

注意:

  • Win32环境
  • 使用Visual Studio
  • Boost
  • 没有MFC
  • 不关心可移植性

问题:

  • 我如何相应地移植getopt()?
    • 移植时我应该注意哪些指导原则?
  • 具有相同功能的已知端口?

3 个答案:

答案 0 :(得分:6)

这可能有所帮助,它也很容易整合

http://www.codeproject.com/KB/cpp/xgetopt.aspx

答案 1 :(得分:3)

最初由IBM提供的一些旧代码可以按原样使用。它只有getopt的实现,而不是_long变体。 它可以在http://plexfx.org/news/files/70411c2c371bd686273a8bebc42c45c5-3.html

上找到

答案 2 :(得分:2)

您必须查看许可证要求,但GCC库的源代码是免费提供的。从那里抓住getopt()。