开发者

Programmatically reading contents of /etc

开发者 https://www.devze.com 2022-12-10 04:55 出处:网络
I want to programmatically read the contents of the 开发者_StackOverflow中文版/etc directory. If possible please reply with the code to achieve this./etc directory is a usual directory. Work with it a

I want to programmatically read the contents of the 开发者_StackOverflow中文版/etc directory. If possible please reply with the code to achieve this.


/etc directory is a usual directory. Work with it as you usually do with any other one.


This is a simple application of opendir() and readdir() functions in C/C++ or their equivalents in Python, Perl or PHP. You will be able to see only files you have access to. It would help if you could explain what you want to accomplish.


The files in /etc are just ordinary files - you read them as you would any other files.

Understanding them on the other hand is more difficult - each file can have its own syntax, let alone attaching any meaning to the options within.

There is no special API for accessing the files in /etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号