Read linux kernel version using C?

后端 未结 6 874
花落未央
花落未央 2021-01-17 22:25

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.

If I dont want

6条回答
  •  青春惊慌失措
    2021-01-17 23:00

    This should do:

    system("uname -r");
    

    EDIT: type man uname in a terminal to get the list of options you can use with uname

提交回复
热议问题