Problem with atol

22 Aug 2011

#include "mbed.h"
Serial pc(USBTX, USBRX); // tx, rx

int main ()
  long long i;
  char szInput [64]="123456789012";
  i = atoll (szInput);
  pc.printf ("The value is %ld",i);
  return 0;

This code works with 10 digits in the string, but not with 12. How is this possible that it behaves like an integer? Might it be a problem with the atoll?

22 Aug 2011

Issue solved. In the printf command it should be %lld.