其中存储命令行参数? [英] where command line arguments are stored?

查看:194
本文介绍了其中存储命令行参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怀疑@命令行参数的存储。



myprog.exe -cfgfile myconfig.cfg



其中OS存储它?

解决方案

对于WIndows,命令行参数保存在进程环境块中( PEB ),它在创建进程时分配在用户进程地址空间中。



您可以阅读Windows Internals了解更多详细信息。以下是



我假设它对于Unix风格是一样的。此数据需要在进程内存中,以便进程可以访问它。


I have a doubt @ the storage of command line arguments.

myprog.exe -cfgfile myconfig.cfg

commandline args are passed when process gets created so are they strored outside the process?

where OS stores it?

解决方案

For WIndows, the command line arguments are kept in the process environment block (PEB), which is allocated in the user process address space when the process is created.

You can read Windows Internals for a lot more details. Here's a snippet from Chapter 5 - Processes, Threads, and Jobs.

I would assume that it's the same for the Unix flavors. This data needs to be in the process memory, so that it can be accessed by the process itself.

这篇关于其中存储命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆