Get Computer Name and logged user name

前端 未结 6 1433
走了就别回头了
走了就别回头了 2021-02-07 01:59

I am developing an application. One of the methods needs to capture the computer name and user logged on the machine, then display both to the user. I need it to run on both Win

6条回答
  •  天涯浪人
    2021-02-07 02:11

    If you can use Boost, you can do this to easily get the host name:

    #include 
    // ... whatever ...
    const auto host_name = boost::asio::ip::host_name();
    

提交回复
热议问题