get your computer name using c++, windows only
hi all,
you can get your computer name, which use windows operating system by using this code:
/*********/
#include <iostream>
#include <windows.h>
using namespace std;
int main(){
char name[100];
DWORD length=100;
GetComputerName(name, &length);
cout<<name<<endl;
return 0;
}
/*********/
Related Posts
- get machine local time using c++, windows only
- Generate students emails based on there id number
- Binary, Octal, Decimal and Hexadecimal converter(Java)
- Computer Terminology
- Need Windows 7 Look !!
about 9 months ago
Wonderful Code!
You hit the target straightly!
Thanks for post it!
about 6 months ago
Good code.
about 1 month ago
for Visual studio 2008 you should use:
GetComputerNameA(name, &length);