Is this "subItem = citem.substr(12,3);"possible?
I tried using the sub string funtion that i found on string::substr - C++ Reference
But it doesn't seem to work. here's the code below, could anyone tell me if I have done something wrong because i'm quite novice at C++.
Problem line:
Code:
subItem = citem.substr(12,3);
Full code:
Code:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main ()
{
string subItem;
string citem = "0123456789ABCDEFGH";
subItem = citem.substr(12,3);
cout << subItem;
}
Do i have to do something with .c_str()? I thought that i needed it, but it doesn't seem to help, unless i don't know how to use it.