標準ライブラリにはそのような関数はありません。一時バッファ メソッドを使用するか、独自の関数を最初から作成する必要があります。
あなたの質問に答えるには:いいえ、標準関数はありませんが、独自の関数を作成するのは簡単です:
#include <stdio.h>
#include <ctype.h>
int natoi(char *s, int n)
{
int x = 0;
while(isdigit(s[0]) && n--)
{
x = x * 10 + (s[0] - '0');
s++;
}
return x;
}
int main(int argc, char*argv[])
{
int i;
for(i = 1; i < argc; i++)
printf("%d: %d\n", i, natoi(argv[i], 5));
}
strntol はおそらくあなたが求めているものです... ただし、標準の C ではありません。