Thứ Năm, 21 tháng 7, 2011

Convert std::string to int and vice versa

 You can convert std::string to int by this syntax:

std::string sNumber = "123";
int number;

number = atoi(sNumber.c_str());

To convert int to std::string, you can convert int to char*, after that you can convert char* to std::string
To convert int to char*, you can be able to use this syntax


char str[10];
itoa(number,str,10);  // 10 --> convert to 10 base

Không có nhận xét nào:

Đăng nhận xét

Install Kubernetes using kubeadm with two nodes master & worker

Well come back for a long time my friends! Today I want to take a note about some basic knowledge about Kubernetes. I hope that it will...