C++ std::string
개체를 Ruby VALUE
개체로 변환하려면 어떻게해야합니까?C++ std :: string to Ruby VALUE
rb_str_new2(c_string)
을 시도했지만 작동하지 않았습니다.
나는 함수를
VALUE foo(){return rb_str_new2(c_string);};
이 그 오류 메시지가 있습니다 :
cannot convert ‘std::string {aka std::basic_string<char>}’ to ‘const char*’ for argument ‘1’ to ‘size_t strlen(const char*)’
어떻게 작동하지 않았다 :
하나를 얻을하는 데 사용할 수 있습니다? 당신의 코드는 무엇입니까? –std::string::c_str()
멤버 함수rb_str_new2 (string_object.c_str()); 일을 쉽게해야합니다. –
C 문자열이 아니라면 왜 변수'c_string'을 호출합니까? oO –