Skip to content

Instantly share code, notes, and snippets.

@kuba-orlik
Created August 20, 2014 11:32
Show Gist options
  • Save kuba-orlik/cd84f9e5631230833d40 to your computer and use it in GitHub Desktop.
Save kuba-orlik/cd84f9e5631230833d40 to your computer and use it in GitHub Desktop.
Returning dynamically generated array of char in c++
std::string returning_string(){
//
..code here
std::string result=...
//
int length = result.length();
char* char_array = new char[length];
strcpy_s(char_array, length+1, wrapped_bstr);
return char_array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment