Skip to content

Commit 6334187

Browse files
authored
Merge pull request MicrosoftDocs#321 from MicrosoftDocs/master
Merge to live
2 parents 5ecaca0 + 5145480 commit 6334187

File tree

4 files changed

+140
-131
lines changed

4 files changed

+140
-131
lines changed

docs/c-runtime-library/reference/strtok-s-strtok-s-l-wcstok-s-wcstok-s-l-mbstok-s-mbstok-s-l.md

Lines changed: 129 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -76,151 +76,158 @@ translation.priority.ht:
7676
- "zh-tw"
7777
---
7878
# strtok_s, _strtok_s_l, wcstok_s, _wcstok_s_l, _mbstok_s, _mbstok_s_l
79+
7980
Finds the next token in a string, by using the current locale or a locale that's passed in. These versions of [strtok, _strtok_l, wcstok, _wcstok_l, _mbstok, _mbstok_l](../../c-runtime-library/reference/strtok-strtok-l-wcstok-wcstok-l-mbstok-mbstok-l.md) have security enhancements, as described in [Security Features in the CRT](../../c-runtime-library/security-features-in-the-crt.md).
8081

8182
> [!IMPORTANT]
8283
> `_mbstok_s` and `_mbstok_s_l` cannot be used in applications that execute in the Windows Runtime. For more information, see [CRT functions not supported with /ZW](http://msdn.microsoft.com/library/windows/apps/jj606124.aspx).
8384
8485
## Syntax
8586

86-
```
87-
88-
char *strtok_s(
89-
char *strToken,
90-
const char *strDelimit,
91-
char **context
92-
);
93-
char *_strtok_s_l(
94-
char *strToken,
95-
const char *strDelimit,
96-
char **context,
97-
_locale_tlocale
98-
);
99-
wchar_t *wcstok_s(
100-
wchar_t *strToken,
101-
const wchar_t *strDelimit,
102-
wchar_t**context
87+
```
88+
char* strtok_s(
89+
char* str,
90+
const char* delimiters,
91+
char** context
92+
);
93+
94+
char* _strtok_s_l(
95+
char* str,
96+
const char* delimiters,
97+
char** context,
98+
_locale_t locale
10399
);
100+
101+
wchar_t* wcstok_s(
102+
wchar_t* str,
103+
const wchar_t* delimiters,
104+
wchar_t** context
105+
);
106+
104107
wchar_t *_wcstok_s_l(
105-
wchar_t *strToken,
106-
const wchar_t *strDelimit,
107-
wchar_t**context,
108-
_locale_tlocale
108+
wchar_t* str,
109+
const wchar_t* delimiters,
110+
wchar_t** context,
111+
_locale_t locale
109112
);
110-
unsigned char *_mbstok_s(
111-
unsigned char*strToken,
112-
const unsigned char *strDelimit,
113-
char **context
113+
114+
unsigned char* _mbstok_s(
115+
unsigned char* str,
116+
const unsigned char* delimiters,
117+
char** context
114118
);
115-
unsigned char *_mbstok_s(
116-
unsigned char*strToken,
117-
const unsigned char *strDelimit,
118-
char **context,
119-
_locale_tlocale
119+
120+
unsigned char* _mbstok_s(
121+
unsigned char* str,
122+
const unsigned char* delimiters,
123+
char** context,
124+
_locale_t locale
120125
);
121126
```
122127

123-
#### Parameters
124-
`strToken`
125-
String containing token or tokens.
128+
### Parameters
129+
130+
*str*
131+
A string containing the token or tokens to find.
126132

127-
`strDelimit`
128-
Set of delimiter characters.
133+
*delimiters*
134+
The set of delimiter characters to use.
129135

130-
`context`
131-
Used to store position information between calls to `strtok_s`
136+
*context*
137+
Used to store position information between calls to the function.
132138

133-
`locale`
134-
Locale to use.
139+
*locale*
140+
The locale to use.
135141

136142
## Return Value
137-
Returns a pointer to the next token found in `strToken`. They return `NULL` when no more tokens are found. Each call modifies `strToken` by substituting a `NULL` character for the first delimiter that occurs after the returned token.
143+
144+
Returns a pointer to the next token found in *str*. Returns `NULL` when no more tokens are found. Each call modifies *str* by substituting a `NULL` character for the first delimiter that occurs after the returned token.
138145

139146
### Error Conditions
140147

141-
|`strToken`|`strDelimit`|`context`|Return value|`errno`|
148+
|*str*|*delimiters*|*context*|Return value|`errno`|
142149
|----------------|------------------|---------------|------------------|-------------|
143150
|`NULL`|any|pointer to a null pointer|`NULL`|`EINVAL`|
144151
|any|`NULL`|any|`NULL`|`EINVAL`|
145152
|any|any|`NULL`|`NULL`|`EINVAL`|
146153

147-
If `strToken` is `NULL` but context is a pointer to a valid context pointer, there is no error.
154+
If *str* is `NULL` but *context* is a pointer to a valid context pointer, there is no error.
148155

149156
## Remarks
150-
The `strtok_s` function finds the next token in `strToken`. The set of characters in `strDelimit` specifies possible delimiters of the token to be found in `strToken` on the current call. `wcstok_s` and `_mbstok_s` are wide-character and multibyte-character versions of `strtok_s`. The arguments and return values of `wcstok_s` and `_wcstok_s_l` are wide-character strings; those of `_mbstok_s` and `_mbstok_s_l` are multibyte-character strings. These three functions behave identically otherwise.
151-
152-
This function validates its parameters. If an error condition occurs, as in the Error Conditions table, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, these functions set `errno` to `EINVAL` and return `NULL`.
153-
154-
### Generic-Text Routine Mappings
155-
156-
|TCHAR.H routine|_UNICODE & _MBCS not defined|_MBCS defined|_UNICODE defined|
157-
|---------------------|------------------------------------|--------------------|-----------------------|
158-
|`_tcstok_s`|`strtok_s`|`_mbstok_s`|`wcstok_s`|
159-
|`_tcstok_s_l`|`_strtok_s_l`|`_mbstok_s_l`|`_wcstok_s_l`|
160-
161-
On the first call to `strtok_s` the function skips leading delimiters and returns a pointer to the first token in `strToken`, terminating the token with a null character. More tokens can be broken out of the remainder of `strToken` by a series of calls to `strtok_s`. Each call to `strtok_s` modifies `strToken` by inserting a null character after the token returned by that call. The `context` pointer keeps track of which string is being read and where in the string the next token is to be read. To read the next token from `strToken`, call `strtok_s` with a `NULL` value for the `strToken` argument, and pass the same `context` parameter. The `NULL` `strToken` argument causes `strtok_s` to search for the next token in the modified `strToken`. The `strDelimit` argument can take any value from one call to the next so that the set of delimiters may vary.
162-
163-
Since the `context` parameter supersedes the static buffers used in `strtok` and `_strtok_l`, it is possible to parse two strings simultaneously in the same thread.
164-
165-
The output value is affected by the setting of the `LC_CTYPE` category setting of the locale; see [setlocale](../../c-runtime-library/reference/setlocale-wsetlocale.md) for more information. The versions of these functions without the `_l` suffix use the current locale for this locale-dependent behavior; the versions with the `_l` suffix are identical except that they use the locale parameter passed in instead. For more information, see [Locale](../../c-runtime-library/locale.md).
166-
167-
## Requirements
168-
169-
|Routine|Required header|
170-
|-------------|---------------------|
171-
|`strtok_s`|\<string.h>|
172-
|`_strtok_s_l`|\<string.h>|
173-
|`wcstok_s`,<br /><br /> `_wcstok_s_l`|\<string.h> or \<wchar.h>|
174-
|`_mbstok_s`,<br /><br /> `_mbstok_s_l`|\<mbstring.h>|
175-
176-
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
177-
178-
## Example
179-
180-
```
181-
// crt_strtok_s.c
182-
// In this program, a loop uses strtok_s
183-
// to print all the tokens (separated by commas
184-
// or blanks) in two strings at the same time.
185-
//
186-
187-
#include <string.h>
188-
#include <stdio.h>
189-
190-
char string1[] =
191-
"A string\tof ,,tokens\nand some more tokens";
192-
char string2[] =
193-
"Another string\n\tparsed at the same time.";
194-
char seps[] = " ,\t\n";
195-
char *token1 = NULL;
196-
char *token2 = NULL;
197-
char *next_token1 = NULL;
198-
char *next_token2 = NULL;
199-
200-
int main( void )
201-
{
202-
printf( "Tokens:\n" );
203-
204-
// Establish string and get the first token:
205-
token1 = strtok_s( string1, seps, &next_token1);
206-
token2 = strtok_s ( string2, seps, &next_token2);
207-
208-
// While there are tokens in "string1" or "string2"
209-
while ((token1 != NULL) || (token2 != NULL))
210-
{
211-
// Get next token:
212-
if (token1 != NULL)
213-
{
214-
printf( " %s\n", token1 );
215-
token1 = strtok_s( NULL, seps, &next_token1);
216-
}
217-
if (token2 != NULL)
218-
{
219-
printf(" %s\n", token2 );
220-
token2 = strtok_s (NULL, seps, &next_token2);
221-
}
222-
}
223-
}
157+
158+
The `strtok_s` family of functions finds the next token in *str*. The set of characters in *delimiters* specifies possible delimiters of the token to be found in *str* on the current call. `wcstok_s` and `_mbstok_s` are wide-character and multibyte-character versions of `strtok_s`. The arguments and return values of `wcstok_s` and `_wcstok_s_l` are wide-character strings; those of `_mbstok_s` and `_mbstok_s_l` are multibyte-character strings. These functions behave identically otherwise.
159+
160+
This function validates its parameters. If an error condition occurs, as in the Error Conditions table, the invalid parameter handler is invoked, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, these functions set `errno` to `EINVAL` and return `NULL`.
161+
162+
On the first call to `strtok_s` the function skips leading delimiters and returns a pointer to the first token in *str*, terminating the token with a null character. More tokens can be broken out of the remainder of *str* by a series of calls to `strtok_s`. Each call to `strtok_s` modifies *str* by inserting a null character after the token returned by that call. The *context* pointer keeps track of which string is being read and where in the string the next token is to be read. To read the next token from *str*, call `strtok_s` with a `NULL` value for the *str* argument, and pass the same *context* parameter. The `NULL` *str* argument causes `strtok_s` to search for the next token in the modified *str*. The *delimiters* argument can take any value from one call to the next so that the set of delimiters may vary.
163+
164+
Since the *context* parameter supersedes the static buffers used in `strtok` and `_strtok_l`, it is possible to parse two strings simultaneously in the same thread.
165+
166+
The output value is affected by the setting of the `LC_CTYPE` category setting of the locale; see [setlocale](../../c-runtime-library/reference/setlocale-wsetlocale.md) for more information. The versions of these functions without the `_l` suffix use the current thread locale for this locale-dependent behavior. The versions with the `_l` suffix are identical except that they instead use the *locale* parameter. For more information, see [Locale](../../c-runtime-library/locale.md).
167+
168+
## Requirements
169+
170+
|Routine|Required header|
171+
|-------------|---------------------|
172+
|`strtok_s`|\<string.h>|
173+
|`_strtok_s_l`|\<string.h>|
174+
|`wcstok_s`,<br />`_wcstok_s_l`|\<string.h> or \<wchar.h>|
175+
|`_mbstok_s`,<br />`_mbstok_s_l`|\<mbstring.h>|
176+
177+
For additional compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
178+
179+
### Generic-Text Routine Mappings
180+
181+
|TCHAR.H routine|\_UNICODE & \_MBCS not defined|\_MBCS defined|_UNICODE defined|
182+
|---------------------|------------------------------------|--------------------|-----------------------|
183+
|`_tcstok_s`|`strtok_s`|`_mbstok_s`|`wcstok_s`|
184+
|`_tcstok_s_l`|`_strtok_s_l`|`_mbstok_s_l`|`_wcstok_s_l`|
185+
186+
## Example
187+
188+
```C
189+
// crt_strtok_s.c
190+
// In this program, a loop uses strtok_s
191+
// to print all the tokens (separated by commas
192+
// or blanks) in two strings at the same time.
193+
194+
#include <string.h>
195+
#include <stdio.h>
196+
197+
char string1[] =
198+
"A string\tof ,,tokens\nand some more tokens";
199+
char string2[] =
200+
"Another string\n\tparsed at the same time.";
201+
char seps[] = " ,\t\n";
202+
char *token1 = NULL;
203+
char *token2 = NULL;
204+
char *next_token1 = NULL;
205+
char *next_token2 = NULL;
206+
207+
int main(void)
208+
{
209+
printf("Tokens:\n");
210+
211+
// Establish string and get the first token:
212+
token1 = strtok_s(string1, seps, &next_token1);
213+
token2 = strtok_s(string2, seps, &next_token2);
214+
215+
// While there are tokens in "string1" or "string2"
216+
while ((token1 != NULL) || (token2 != NULL))
217+
{
218+
// Get next token:
219+
if (token1 != NULL)
220+
{
221+
printf(" %s\n", token1);
222+
token1 = strtok_s(NULL, seps, &next_token1);
223+
}
224+
if (token2 != NULL)
225+
{
226+
printf(" %s\n", token2);
227+
token2 = strtok_s(NULL, seps, &next_token2);
228+
}
229+
}
230+
}
224231
```
225232
226233
```Output
@@ -243,8 +250,9 @@ Tokens:
243250
```
244251

245252
## See Also
246-
[String Manipulation](../../c-runtime-library/string-manipulation-crt.md)
247-
[Locale](../../c-runtime-library/locale.md)
248-
[Interpretation of Multibyte-Character Sequences](../../c-runtime-library/interpretation-of-multibyte-character-sequences.md)
249-
[strcspn, wcscspn, _mbscspn, _mbscspn_l](../../c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l.md)
250-
[strspn, wcsspn, _mbsspn, _mbsspn_l](../../c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l.md)
253+
254+
[String Manipulation](../../c-runtime-library/string-manipulation-crt.md)
255+
[Locale](../../c-runtime-library/locale.md)
256+
[Interpretation of Multibyte-Character Sequences](../../c-runtime-library/interpretation-of-multibyte-character-sequences.md)
257+
[strcspn, wcscspn, _mbscspn, _mbscspn_l](../../c-runtime-library/reference/strcspn-wcscspn-mbscspn-mbscspn-l.md)
258+
[strspn, wcsspn, _mbsspn, _mbsspn_l](../../c-runtime-library/reference/strspn-wcsspn-mbsspn-mbsspn-l.md)

docs/error-messages/compiler-errors-1/fatal-error-c1001.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ translation.priority.ht:
3535
- "zh-tw"
3636
---
3737
# Fatal Error C1001
38-
INTERNAL COMPILER ERROR(compiler file file, line number)
38+
39+
> INTERNAL COMPILER ERROR(compiler file *file*, line *number*)
3940
40-
The compiler cannot generate correct code for a construct, probably due to the combination of an expression and an optimization option. Try removing one or more optimization options and recompiling the function containing the line indicated in the error message.
41-
42-
You can probably fix the problem by removing one or more optimization options. To determine which option is at fault, remove options one at a time and recompile until the error message goes away. The options most commonly responsible are **/Og**, **/Oi**, and `/Oa`. Once you determine which option is responsible, you can disable it using the [optimize](../../preprocessor/optimize.md) pragma around the function where the error occurs and continue to use the option for the rest of the module.
43-
44-
The Microsoft Knowledge Base has more information about C1001; see [http://support.microsoft.com/default.aspx?scid=kb;en-us;134650](http://support.microsoft.com/default.aspx?scid=kb;en-us;134650).
45-
46-
Try rewriting the line where the error is reported, or several lines of code surrounding that line.
41+
The compiler cannot generate correct code for a construct, often due to the combination of a particular expression and an optimization option, or an issue in parsing. If the compiler file listed has a utc or C2 path segment, it is probably an optimization error. If the file has a cxxfe or c1xx path segment, or is msc1.cpp, it is probably a parser error. If the file named is cl.exe, there is no other information available.
42+
43+
You can often fix an optimization problem by removing one or more optimization options. To determine which option is at fault, remove options one at a time and recompile until the error message goes away. The options most commonly responsible are [/Og (Global optimizations)](../../build/reference/og-global-optimizations.md) and [/Oi (Generate Intrinsic Functions)](../../build/reference/oi-generate-intrinsic-functions.md). Once you determine which optimization option is responsible, you can disable it around the function where the error occurs by using the [optimize](../../preprocessor/optimize.md) pragma, and continue to use the option for the rest of the module. For more information about optimization options, see [Optimization best practices](../../build/reference/optimization-best-practices.md).
44+
45+
If optimizations are not responsible for the error, try rewriting the line where the error is reported, or several lines of code surrounding that line. To see the code the way the compiler sees it after preprocessing, you can use the [/P (Preprocess to a file)](../../build/reference/p-preprocess-to-a-file.md) option.
46+
47+
For more information about how to isolate the source of the error and how to report an internal compiler error to Microsoft, see [How to Report a Problem with the Visual C++ Toolset](../../how-to-report-a-problem-with-the-visual-cpp-toolset.md).

docs/linux/create-a-new-linux-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Create a New Linux Project | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/16/2016"
4+
ms.date: "08/16/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology:
@@ -33,7 +33,7 @@ translation.priority.ht:
3333
To create a new Linux project in Visual Studio, do the following:
3434

3535
1. Select **File > New Project** in Visual Studio, or press **Ctrl + Shift + N**.
36-
1. Select the **Templates > Other Languages > Visual C++ > Cross Platform > Linux** node and then select the project type you would like to create, enter a Name/Location, and click OK.
36+
1. Select the **Visual C++ > Cross Platform > Linux** node and then select the project type you would like to create, enter a Name/Location, and click OK.
3737

3838
![New Linux Project](media/newproject.png)
3939

docs/linux/media/newproject.png

24.8 KB
Loading

0 commit comments

Comments
 (0)