我的应用程序可能传入了大量参数,我想避免将参数复制到过滤列表中的命中内存。我想就地过滤它们,但我很确定弄乱 argv 数组本身或它指向的任何数据可能是不可取的。有什么建议吗?
最佳答案
C99 标准关于修改 argv
(和 argc
)是这样说的:
The parameters argc and argv and the strings pointed to by the argv array shall be modifiable by the program, and retain their last-stored values between program startup and program termination.
关于c - 是否可以更改 argv 或我是否需要创建它的调整副本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/963493/