In many languages there are libraries, either built into the language itself or built separately outside of the language, which allow information to be taken from the operating system at some level. Examples are metadata about a file, current memory usage and the OS version itself.
How is this information generally accessed?
At the moment the only way I can see it working is through executing command line functions and parsing the answer.
For example, to list the files in a current directory on Linux your application would execute ‘ls’ at the specified directory and then parse the output to produce the required format. Is this the only way?
This example assumes you are using no libraries which do it for you of course (or maybe you’re building a library for this purpose.
2
Every operating system offers so-called application programming interfaces (APIs) that allow a user program to access such information. The command line commands effectively use these APIs — e.g. ls
does just that.
Wikipedia has a list of operating system APIs.
4