zoukankan      html  css  js  c++  java
  • C++ GetComputerName()

    关于函数“GetComputerName()”,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724295(v=vs.85).aspx

    关于“Computer Names”,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724220(v=vs.85).aspx

    代码摘自“Getting System Information”,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms724426(v=vs.85).aspx

    关于“Windows Data Types”,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx

    IDE: Code::Blocks

    操作系统:Windows 7 x64

     1 #include <stdio.h>
     2 #include <tchar.h>
     3 #include <windows.h>
     4 
     5 #define INFO_BUFFER_SIZE (MAX_COMPUTERNAME_LENGTH + 1)
     6 
     7 int main()
     8 {
     9     CHAR infoBuf[INFO_BUFFER_SIZE];
    10     DWORD bufCharCount = INFO_BUFFER_SIZE;
    11 
    12     // Get and display the name of the computer.
    13     if( GetComputerName( infoBuf, &bufCharCount ) ) {
    14         _tprintf( "The NetBIOS name of the local computer is %s 
    ", infoBuf );
    15     }
    16     else {
    17         _tprintf( "Get NetBIOS name of the local computer failed with error %lu 
    ", GetLastError() );
    18     }
    19 
    20     return 0;
    21 }
  • 相关阅读:
    502 bad gateway错误的网关
    nodejs发展
    edgejs
    websocket nodejs实例
    nodejs原码
    node案例
    node 与php整合
    node c#
    jquery
    express
  • 原文地址:https://www.cnblogs.com/Satu/p/8185416.html
Copyright © 2011-2022 走看看