在Mac OS X上,/proc/self/cmdline/GetCommandLine等效项是什么?

编程入门 行业动态 更新时间:2024-10-20 18:52:22
本文介绍了在Mac OS X上,/proc/self/cmdline/GetCommandLine等效项是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在不使用argc,argv的情况下访问Mac OS X上的命令行?在Linux上,我只读/proc/self/cmdline或在Windows上使用GetCommandLine,但找不到与Mac OS X等效的文件.

How can I access the command line on Mac OS X without using argc, argv? On Linux, I would simply read /proc/self/cmdline or use GetCommandLine on Windows, but I can't find the equivalent for Mac OS X.

推荐答案

在 crt_externs.h .但是,仅将argc/argv存储在main开头并存储到所有三个平台中会不会更简单?

There are functions called _NSGetArgv and _NSGetArgc in crt_externs.h. However, wouldn't it be simpler to just store the argc/argv in a variable at the start of main and be portable to all three platforms?

注意:这些函数没有直接记录,但在应用工具包功能参考,并且相关的_NSGetEnviron在 environ(7)联机帮助页.

NOTE: These functions are not directly documented, but they are mentioned in the documentation for NSApplicationMain in the Application Kit Functions Reference, and the related _NSGetEnviron is mentioned in the environ(7) manpage.

更多推荐

在Mac OS X上,/proc/self/cmdline/GetCommandLine等效项是什么?

本文发布于:2023-10-07 15:18:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469746.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:OS   Mac   proc   GetCommandLine   cmdline

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!