fork(5) download
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. int main() {
  5. char a[] = "123";
  6. char *p;
  7. long l = strtol (a, &p, 10);
  8. std::cout << l << ' ' << (p == a + 3) << '\n';
  9.  
  10. char b[] = "abc";
  11. l = strtol (b, &p, 10);
  12. std::cout << l << ' ' << (p == b + 3);
  13. }
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
123 1
0 0