Talk:c/io/fscanf
Isn't the table of specifiers inconsistent?
I mean, for specifiers d, i, u, o, x the description says that "The format of the number is the same as expected by strtol()/strtoul()", while on the right we see that long long integers can be read, provided that appropiate length modifier is specified.
Well, strtol() doesn't support long longs. strtoll() does. So, shouldn't the description say, "The format of the number is the same as expected by stroll()"?
- The C standard in §7.21.6.2/11 only says strtol and strtoul, although I agree that the apparent intent was to specify strtoul/strtoull for %lld/%llu and strtoimax/strotoumax for %jd/%ju... maybe. I think it's worth checking with the implementations and making a note under the table. --Cubbi (talk) 10:40, 15 December 2015 (PST)
[edit] Usage of "successfully" in "Return Value"
Please see this StackOverflow answer (and associated question) where it is underlined that the standard doesn't define nor mention "success" in assigning values to the passed variables. Using this word may be misleading.
[edit] C++ mentions
Complexity: Not guaranteed. Notably, some implementations of sscanf are O(N), where N = std::strlen(buffer) [1]. For performant string parsing, see std::from_chars.
I believe this should be reworded, since this is the C page, not the C++ one . std::strlen(); should be just strlen(); I do not know what should be written instead of the std::from_chars(); note, since C has no alternative to sscanf().
Babbage (talk) 17:17, 3 July 2022 (PDT)
- Quite reasonable observation, thank you.) Historically, the "Complexity" notion was just copied from C++ page w/o an adjustment. ✔ Fixed. --Space Mission (talk) 08:36, 4 July 2022 (PDT)