How to convert from const char* to unsigned int c++

c++

Solution

#include <iostream>
#include <sstream>

const char* value = "1234567";
stringstream strValue;
strValue << value;

unsigned int intValue;
strValue >> intValue;

cout << value << endl;
cout << intValue << endl;

Output:

1234567

1234567

Problem

I am new in c++ programming and I have been trying to convert from const char* to unsigned int with no luck. I have a: ``` const char* charVar; ``` and i need to convert it to: ``` unsigned int uintVar; ``` How can it be done in C++? Thanks

Original source