tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: RFC - add snscanf(3) to stdio
In article <48B90796.3050503%netbsd.org@localhost>
darrenr%netbsd.org@localhost writes:
> Thus I'd like to introduce the following:
> int snscanf(const char *str, const size_t buflen, const char *format, ...);
> int vsnscanf(const char *str, const size_t buflen, const char *format,
> va_list ap);
>
> The result would be the above code changed to look like this:
>
> line = fgetln(fp, &lsize)
> if (line != NULL && lsize > 0)
> snscanf(line, lsize, "%d", &integer);
>
> and there would be no need for a gratutious \0 to be added.
What does the first 's' stand for?
A string in C is defined as a nul-terminated array of char,
and an array of char without nul-termination is not a string.
What about "memscanf", "bscanf" (a la "memcpy"/"bcopy") or something?
--
ITOH Yasufumi
Home |
Main Index |
Thread Index |
Old Index