Open AndrewChe7 opened 4 years ago
I want libc free and libc's atoi()
and sscanf
is affected by locale(e.g. see https://forum.openframeworks.cc/t/problem-with-locale-and-sscanf-ofximgui-related/30178 ), so provided our own implementation.
You can send a better atoi implementation(e.g. implement more robust one add more error checks). PR is always welcome.
https://github.com/syoyo/tinyobjloader-c/blob/1ee072e2f282789906d5aa9e8557f22c7711d80a/tinyobj_loader_c.h#L196
for atoi function really hard to check errors, because it returns integer for input params, so you can't check it for bad input. You can use sscanf(buf, "%d", &n) to get integer from string and return value will be != 1 if there is problems.