fork download
  1. #include <iostream>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. const char s[] = "32tgf";
  7. char* p;
  8. long converted = strtol(s, &p, 10);
  9. if (*p) {
  10. std::cout << "Not a number\n";
  11. }
  12. else {
  13. std::cout << "Ok.\n";
  14. }
  15. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Not a number