linux c - get server hostname?

前端 未结 3 1727
南笙
南笙 2021-02-14 18:25

Does anyone know a function to get the hostname of the linux server? I don\'t really want to have to include any headers or compile other libraries, hoping there is a function b

3条回答
  •  误落风尘
    2021-02-14 19:09

    Some useful information can be found among environment variables. You will need to include (unfortunately) stdlib.h and you will obtain some useful functions

提交回复
热议问题