gethostname.cc
来自「达内IT培训Unix C++第一天源码 是入门Unix 下C++编程的好东西」· CC 代码 · 共 14 行
CC
14 行
#include <iostream>using namespace std;#include <unistd.h>int main(){ char name[256]; if(gethostname(name, 256)<0) cout << "cannot get hostname"<<endl; else cout << "name:" << name << endl;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?