delorie.com/djgpp/doc/libc/libc_671.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

SCN

Syntax

 
#include <inttypes.h>

Description

The SCN family of macros allows integers to be input in a portable manner using the scanf family of functions (see section scanf). They include a conversion qualifier, to specify the width of the type (e.g.: l for long), and the conversion type specifier (e.g.: d for decimal display of integers).

The SCN family of macros should be used with the types defined in the header <stdint.h>. For example: int8_t, uint_fast32_t, uintptr_t, intmax_t.

Below N can be 8, 16, 32 or 64. The SCN macros are:

SCNdN
SCNiN

The d and i type conversion specifiers for a type intN_t of N bits.

SCNdLEASTN
SCNiLEASTN

The d and i type conversion specifiers for a type int_leastN_t of N bits.

SCNdFASTN
SCNiFASTN

The d and i type conversion specifiers for a type int_fastN_t of N bits.

SCNdMAX
SCNiMAX

The d and i type conversion specifiers for a type intmax_t.

SCNdPTR
SCNiPTR

The d and i type conversion specifier for a type intptr_t.

SCNoN
SCNuN
SCNxN

The o, u and x type conversion specifiers for a type uintN_t of N bits.

SCNoLEASTN
SCNuLEASTN
SCNxLEASTN

The o, u and x type conversion specifiers for a type uint_LEASTN_t of N bits.

SCNoFASTN
SCNuFASTN
SCNxFASTN

The o, u and x type conversion specifiers for a type uint_FASTN_t of N bits.

SCNoMAX
SCNuMAX
SCNxMAX

The o, u and x type conversion specifiers for a type uintmax_t.

SCNoPTR
SCNuPTR
SCNxPTR

The o, u and x type conversion specifiers for a type uintptr_t.

Return Value

Not applicable.

Portability

ANSI/ISO C C99; not C89
POSIX 1003.1-2001; not 1003.2-1992

Example

 
intmax_t m;
int ret;

ret = sscanf("0x1000", "%" SCNxMAX, &m);


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004