Hi.

I have a character array of the form "0abcdef" or "1defghi". I have to remove the first character and convert the rest to a string. So in this case, the strings would be abcdef and defghi.

I know that saying string s(char array) does a direct conversion but I need to know how to do the split and conversion efficiently(without copying into another array)

-AutoC

const char *s = "1abcdef";
string str( (s+1) ); //copy from 'a' onwards.

Just what I was looking for. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.