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:
Full code:Code:subItem = citem.substr(12,3);
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.Code:#include <iostream> #include <vector> #include <string> using namespace std; int main () { string subItem; string citem = "0123456789ABCDEFGH"; subItem = citem.substr(12,3); cout << subItem; }



LinkBack URL
About LinkBacks


