Skip to content

Instantly share code, notes, and snippets.

@colbyhall
Created January 31, 2020 19:18
Show Gist options
  • Select an option

  • Save colbyhall/5c02078a1f6a5e82548bfbfeefbc3ba3 to your computer and use it in GitHub Desktop.

Select an option

Save colbyhall/5c02078a1f6a5e82548bfbfeefbc3ba3 to your computer and use it in GitHub Desktop.
std::string get_std_string() {
return "foo bar";
}
void do_thing_with_c_str(const char* c_str) {
// something
}
int main() {
char* c_str = get_std_string().c_str();
do_thing_with_c_str(c_str);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment