📄 kkkk.cpp
字号:
// kkkk.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
//int _tmain(int argc, _TCHAR* argv[])
//{
//
//
// char * pch = new char[256];
// //pch = "afsdfasdfasdf";
//
// strcpy( pch, "asdfasdfasdfasdf");
// delete [] pch;
//
//
//
// getchar();
// return 0;
//}
//
#include <windows.h>
#include <stdio.h>
#include <Winbase.h>
#define BUFSIZE 1024
void main()
{
LPTSTR lpszSystemInfo; // pointer to system information string
DWORD cchBuff = BUFSIZE; // size of computer or user name
TCHAR tchBuffer[BUFSIZE]; // buffer for string
DWORD dwResult; // function return value
lpszSystemInfo = tchBuffer;
// Get and display the name of the computer.
if( GetComputerName(lpszSystemInfo, &cchBuff) )
printf("Computer name: %s\n", lpszSystemInfo);
// Get and display the user name.
cchBuff = BUFSIZE;
if( GetUserName(lpszSystemInfo, &cchBuff) )
printf("User name: %s\n\n", lpszSystemInfo);
// Get and display the system directory.
if( GetSystemDirectory(lpszSystemInfo, MAX_PATH+1) )
printf("System directory: %s\n", lpszSystemInfo);
// Get and display the Windows directory.
if( GetWindowsDirectory(lpszSystemInfo, MAX_PATH+1) )
printf("Windows directory: %s\n\n", lpszSystemInfo);
// Display the "environment variables" header.
printf("Environment variables (partial list): \n");
// Expand the OS environment variable.
dwResult = ExpandEnvironmentStrings(
"OS=%OS%",
lpszSystemInfo,
BUFSIZE);
if( dwResult <= BUFSIZE )
printf(" %s\n", lpszSystemInfo);
// Expand the PATH environment variable.
dwResult = ExpandEnvironmentStrings(
"PATH=%PATH%",
lpszSystemInfo,
BUFSIZE);
if( dwResult <= BUFSIZE )
printf(" %s\n", lpszSystemInfo);
// Expand the TMP environment variable.
dwResult = ExpandEnvironmentStrings(
"TEMP=%TEMP%",
lpszSystemInfo,
BUFSIZE);
if( dwResult <= BUFSIZE )
printf(" %s\n", lpszSystemInfo);
getchar();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -