cstringc-standard-library

Is there a strtol equivalent that does not require a null-terminated string?


Is there a standard C function similar to strtol which will take a char* and a length for a non-null-terminated string?

I know that I could copy out the string into a null-terminated region, but for efficiency reasons that is undesirable.


Solution

  • No such function in the standard library. You will either have to use the temporary buffer method, or write your own function from scratch.