Last active
August 29, 2015 14:07
-
-
Save chichunchen/2a0cabf89ceaf16528c1 to your computer and use it in GitHub Desktop.
C++ notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// qt confit in yosemite | |
Qt/5.3/clang_64/mkspecs | |
vim qdevice.pri: macosx10.10 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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