Skip to content

Instantly share code, notes, and snippets.

@kilon
Created March 17, 2018 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kilon/925d5ecc5f40fdf85979289d8dcf811d to your computer and use it in GitHub Desktop.
Save kilon/925d5ecc5f40fdf85979289d8dcf811d to your computer and use it in GitHub Desktop.
C++ string to C string
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
std:string some = "but";
char *foo = &some[0];
cout << "Hello, World!";
printf(foo);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment