Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nl_scanf(3int) — Ultrix WS 2.0 VAX

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

nl_printf(3int)

setlocale(3int)

strtod(3int)

strtol(3int)

getc(3s)

printf(3s)

nl_scanf(3int)

NAME

nl_scanf, nl_fscanf, nl_sscanf − convert formatted input

SYNTAX

#include <stdio.h>

int nl_scanf (format [ , pointer ] ... )
char *format;

int nl_fscanf (stream, format [ , pointer ] ... )
FILE *stream;
char *format;

int nl_sscanf (s, format [ , pointer ] ... )
char *s, *format;

DESCRIPTION

The internationalization functions nl_scanf, nl_fscanf, and nl_sscanf provide similar functionality to scanf except that the conversion character % in scanf is replaced by the sequence %digit$, where digit is a decimal digit n from 1 to 9.  Conversions are applied to the n th argument in the argument list, rather than to the next unused argument. 

The format passed to the input functions can contain either form of conversion specification, but not both in the same format string.

The scanf function in all its forms provides for the detection of a language dependent radix character in the input string. The radix character used is that defined for the language identified by the last successful call to setlocale category LC_NUMERIC. If setlocale category LC_NUMERIC has not been called successfully, or if the radix character is not defined for a supported language, the radix character defaults to a period (.).

The conversion specification is the same as the function except that it can be introduced by either the character sequence %digit$ or the % character, and assignment takes place to the argument digit not to the next sequential argument.  For example:

nl_scanf("%2$s %1$d", integer, string)

with input “ january 9 ” assigns 9 to integer and “january” to string.

RETURN VALUE

These functions return either the number of items matched or EOF on end of input, and a short count for missing or illegal data items. 

SEE ALSO

nl_printf(3int), setlocale(3int), strtod(3int), strtol(3int), getc(3s), printf(3s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026