You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `_UNICODE` has been defined, GENTEXT.C maps to the following Unicode version of the program. For more information about using `wmain` in Unicode programs as a replacement for `main`, see [Using wmain](../c-language/using-wmain.md) in *C Language Reference*.
97
-
98
-
```
99
-
// crt_unicgtxt.c
100
-
101
-
/*
102
-
* Use of generic-text mappings defined in TCHAR.H
103
-
* Generic-Text-Mapping example program
104
-
* Unicode version of GENTEXT.C
105
-
*/
106
-
107
-
#include <stdio.h>
108
-
#include <stdlib.h>
109
-
#include <string.h>
110
-
#include <direct.h>
111
-
112
-
int __cdecl wmain(int argc, wchar_t **argv, wchar_t **envp)
113
-
{
114
-
wchar_t buff[_MAX_PATH];
115
-
wchar_t *str = L"Astring";
116
-
char *amsg = "Reversed";
117
-
wchar_t *wmsg = L"Is";
118
-
119
-
printf("Unicode version\n");
120
-
121
-
if (_wgetcwd(buff, _MAX_PATH) == NULL) {
122
-
printf("Can't Get Current Directory - errno=%d\n", errno);
123
-
}
124
-
else {
125
-
wprintf(L"Current Directory is '%s'\n", buff);
126
-
}
127
-
128
-
wprintf(L"'%s' %hs %ls:\n", str, amsg, wmsg);
129
-
wprintf(L"'%s'\n", wcsrev(wcsdup(str)));
130
-
return 0;
131
-
}
132
-
```
133
-
134
-
If neither `_MBCS` nor `_UNICODE` has been defined, GENTEXT.C maps to single-byte ASCII code, as follows:
135
-
136
-
```
137
-
// crt_sbcsgtxt.c
138
-
/*
139
-
* Use of generic-text mappings defined in TCHAR.H
140
-
* Generic-Text-Mapping example program
141
-
* Single-byte (SBCS) Ascii version of GENTEXT.C
142
-
*/
143
-
144
-
#include <stdio.h>
145
-
#include <stdlib.h>
146
-
#include <string.h>
147
-
#include <direct.h>
148
-
149
-
int __cdecl main(int argc, char **argv, char **envp)
150
-
{
151
-
char buff[_MAX_PATH];
152
-
char *str = "Astring";
153
-
char *amsg = "Reversed";
154
-
wchar_t *wmsg = L"Is";
155
-
156
-
printf("SBCS version\n");
157
-
158
-
if (_getcwd(buff, _MAX_PATH) == NULL) {
159
-
printf("Can't Get Current Directory - errno=%d\n", errno);
If `_UNICODE` has been defined, GENTEXT.C maps to the following Unicode version of the program. For more information about using `wmain` in Unicode programs as a replacement for `main`, see [Using wmain](../c-language/using-wmain.md) in *C Language Reference*.
98
+
99
+
```
100
+
// crt_unicgtxt.c
101
+
102
+
/*
103
+
* Use of generic-text mappings defined in TCHAR.H
104
+
* Generic-Text-Mapping example program
105
+
* Unicode version of GENTEXT.C
106
+
*/
107
+
108
+
#include <stdio.h>
109
+
#include <stdlib.h>
110
+
#include <string.h>
111
+
#include <direct.h>
112
+
113
+
int __cdecl wmain(int argc, wchar_t **argv, wchar_t **envp)
114
+
{
115
+
wchar_t buff[_MAX_PATH];
116
+
wchar_t *str = L"Astring";
117
+
char *amsg = "Reversed";
118
+
wchar_t *wmsg = L"Is";
119
+
120
+
printf("Unicode version\n");
121
+
122
+
if (_wgetcwd(buff, _MAX_PATH) == NULL) {
123
+
printf("Can't Get Current Directory - errno=%d\n", errno);
124
+
}
125
+
else {
126
+
wprintf(L"Current Directory is '%s'\n", buff);
127
+
}
128
+
129
+
wprintf(L"'%s' %hs %ls:\n", str, amsg, wmsg);
130
+
wprintf(L"'%s'\n", wcsrev(wcsdup(str)));
131
+
return 0;
132
+
}
133
+
```
134
+
135
+
If neither `_MBCS` nor `_UNICODE` has been defined, GENTEXT.C maps to single-byte ASCII code, as follows:
136
+
137
+
```
138
+
// crt_sbcsgtxt.c
139
+
/*
140
+
* Use of generic-text mappings defined in TCHAR.H
141
+
* Generic-Text-Mapping example program
142
+
* Single-byte (SBCS) Ascii version of GENTEXT.C
143
+
*/
144
+
145
+
#include <stdio.h>
146
+
#include <stdlib.h>
147
+
#include <string.h>
148
+
#include <direct.h>
149
+
150
+
int __cdecl main(int argc, char **argv, char **envp)
151
+
{
152
+
char buff[_MAX_PATH];
153
+
char *str = "Astring";
154
+
char *amsg = "Reversed";
155
+
wchar_t *wmsg = L"Is";
156
+
157
+
printf("SBCS version\n");
158
+
159
+
if (_getcwd(buff, _MAX_PATH) == NULL) {
160
+
printf("Can't Get Current Directory - errno=%d\n", errno);
0 commit comments