使用C阅读Linux内核版本吗? [英] Read linux kernel version using C?
本文介绍了使用C阅读Linux内核版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Ubuntu,并且我想阅读其内核的版本.我在/proc/中找到了一个名为version的文件,该文件记录了当前内核的版本.
I am using Ubuntu and I want to read the version of its kernel. I found a file named version in /proc/ that records the version of the current kernel.
如果我不想读取文件,是否还有其他方法(如C中的内置函数)可以读取C中的版本?
If I dont want to read file, is there any other way, like built-in function in C, that I can read the version in C?
谢谢
推荐答案
检查 uname 一个>功能.它为您提供了很多信息,而无需解析某些linux可执行文件的输出.
Check the uname function. It gives you a lot of information without the need to parse output of some linux executables.
这篇关于使用C阅读Linux内核版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文