Skip to content

Update how-to-convert-between-various-string-types.md #657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 1, 2019
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/text/how-to-convert-between-various-string-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ int main()
cout << printstr << endl;
// The following line of code is an easier way to
// display wide character strings:
// wcout << (LPCTSTR) ccombstr << endl;
wcout << (LPCTSTR) ccombstr << endl;
}

// Convert a wide wchar_t string to a multibyte CStringA,
Expand Down Expand Up @@ -518,7 +518,7 @@ _bstr_t bstrt(origa);
bstrt += _T(" (_bstr_t)");
wcout << bstrt << endl;

// Convert to a wide character_bstr_t string from
// Convert to a wide character _bstr_t string from
// a wide character CStringW string.
bstr_t bstrtw(origw);
bstrtw += " (_bstr_t)";
Expand All @@ -538,8 +538,8 @@ if (ccombstr.Append(_T(" (CComBSTR)")) == S_OK)
// Convert to a wide character CComBSTR string from
// a wide character CStringW string.
CComBSTR ccombstrw(origw);
// Append the type of string to it, and display the result.

// Append the type of string to it, and display the result.
if (ccombstrw.Append(_T(" (CComBSTR)")) == S_OK)
{
CW2A printstrw(ccombstrw);
Expand Down Expand Up @@ -623,7 +623,7 @@ int main()
string orig("Hello, World!");
cout << orig << " (basic_string)" << endl;

// Convert a wide char basic_string string to a multibyte char*
// Convert a wide character basic_string string to a multibyte char*
// string. To be safe, we allocate two bytes for each character
// in the original string, including the terminating null.
const size_t newsize = (strlen(orig.c_str()) + 1)*2;
Expand Down Expand Up @@ -807,4 +807,4 @@ Hello, World! (basic_string)
[wcstombs_s, _wcstombs_s_l](../c-runtime-library/reference/wcstombs-s-wcstombs-s-l.md)<br/>
[strcpy_s, wcscpy_s, _mbscpy_s](../c-runtime-library/reference/strcpy-s-wcscpy-s-mbscpy-s.md)<br/>
[strcat_s, wcscat_s, _mbscat_s](../c-runtime-library/reference/strcat-s-wcscat-s-mbscat-s.md)<br/>
[pin_ptr (C++/CLI)](../windows/pin-ptr-cpp-cli.md)
[pin_ptr (C++/CLI)](../windows/pin-ptr-cpp-cli.md)