Skip to content

Instantly share code, notes, and snippets.

@chichunchen
Last active August 29, 2015 14:07
Show Gist options
  • Save chichunchen/2a0cabf89ceaf16528c1 to your computer and use it in GitHub Desktop.
Save chichunchen/2a0cabf89ceaf16528c1 to your computer and use it in GitHub Desktop.
C++ notes
// qt confit in yosemite
Qt/5.3/clang_64/mkspecs
vim qdevice.pri: macosx10.10
/* string to integer: */
// 1
std::string myString = "45";
int value = atoi(myString.c_str()); //value = 45
// 2
ifastream<basic_formatters, string_reader> myString(&string);
int value;
myString >> value;
// 3
#include <sstream>
#include <string>
using namespace std;
string myStream = "45";
istringstream buffer(myString);
int value;
buffer >> value; // value = 45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment