평가 및 의견을 보내려면 클릭하십시오.
MSDN
MSDN Library
개발 도구 및 언어
Visual Studio 2008
Visual Studio
Visual C++
일반적인 프로그래밍 방법론
네이티브 및 .NET 상호 운용성
관리 코드에서 네이티브 함수 호출
C++ Interop 사용(암시적 PInvoke)
 방법: 표준 문자열을 System::String으로 변환

  저대역폭 보기 설정
이 페이지에서 다루는 특정 제품:.
Microsoft Visual Studio 2008/.NET Framework 3.5

다음 제품들은 다른 버전에서 다루어 집니다.
Visual C++
방법: 표준 문자열을 System::String으로 변환

업데이트: 2007년 11월

이 항목에서는 표준 C++ 라이브러리 문자열(<string>)을 String으로 변환하는 방법을 보여 줍니다.

// convert_standard_string_to_system_string.cpp
// compile with: /clr
#include <string>
#include <iostream>
using namespace System;
using namespace std;

int main() {
   string str = "test";
   cout << str << endl;
   String^ str2 = gcnew String(str.c_str());
   Console::WriteLine(str2);

   // alternatively
   String^ str3 = gcnew String(str.c_str());
   Console::WriteLine(str3);
}
test
test
test
커뮤니티 콘텐츠   커뮤니티 콘텐츠란?
새 콘텐츠 추가 RSS  주석
Processing
© 2009 Microsoft Corporation. All rights reserved. 사용약관  |  상표  |  개인정보보호
Page view tracker