^^^^^^^^ in c++
Printable View
^^^^^^^^ in c++
You can synthesise Left and Right with intelligent use of substr.Code:#include <iostream>
#include <string>
using namespace std;
int main() {
string info = "This is some info in a string!";
string other = info.substr(5, 10); // substr(start, length)
cout << other << endl;
return 0;
}
PS: Get the length using .size() :)
for C strings:
strncpy(to,from,length);