开发者

Programmatically reading contents of /etc

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜