Include :
#include<cstdlib> // for strtol()
#include<cstring> // for strncpy()
and then
strncpy(InputString ,apple.c_str(),40);
^
|
convert to C ctring
Or simply,
unsigned long x = strtoul(apple.c_str(), &pEnd, 2);