?? sharedseg.cpp
字號:
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#define MAX_STRING_SIZE 256
#define INITIAL_STRING __TEXT("(nothing yet)")
#pragma data_seg(".Shared")
TCHAR g_szSharedString[MAX_STRING_SIZE] = INITIAL_STRING;
#pragma data_seg()
int main( int argc, char *argv[]) {
TCHAR szLocalString[MAX_STRING_SIZE];
while (TRUE) {
printf( "Type a string to share, [Enter] to display current string, or \"quit\":\n");
// input string...
_getts( szLocalString);
if (_tcscmp( szLocalString, __TEXT("quit")) == 0) {
// quit...
break;
}
else if (szLocalString[0] == __TEXT('\0')) {
// show the string...
printf( "Current string is '%s'.\n", g_szSharedString);
}
else {
// set the string...
_tcscpy( g_szSharedString, szLocalString);
}
}
// exit...
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -