C
Chris Schumacher
I've been trying to use the following line of code to take a character
from the end of the string:
char b = pStr.substr(pStr.length, 1);
However the compiler (the Visual C++ one) returns the following error:
'substr' : cannot convert parameter 1 from 'unsigned int
(void) const' to 'unsigned int' Conversion is a valid
standard conversion, which can be performed implicitly or by
use of static_cast, C-style cast or function-style cast
I tried static_casting, C-Style and function-style to assign an int
variable the value of the string length, but I got the exact same
error every time.
I also tried use strlen(pStr) and got a similar error (only the data
type of the original was different).
Is there any way to make this work?
Any help is greatly appreciated!
-==Kensu==-
from the end of the string:
char b = pStr.substr(pStr.length, 1);
However the compiler (the Visual C++ one) returns the following error:
'substr' : cannot convert parameter 1 from 'unsigned int
(void) const' to 'unsigned int' Conversion is a valid
standard conversion, which can be performed implicitly or by
use of static_cast, C-style cast or function-style cast
I tried static_casting, C-Style and function-style to assign an int
variable the value of the string length, but I got the exact same
error every time.
I also tried use strlen(pStr) and got a similar error (only the data
type of the original was different).
Is there any way to make this work?
Any help is greatly appreciated!
-==Kensu==-