Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
scanf Prefixes
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The optional F and N prefixes allow the user to override the
default addressing conventions of the memory model being used.
The F (indicates far pointer) and N (indicates near pointer)
prefixes can be used only with %s and %p. Note also that these
prefixes are not part of the ANSI definition for scanf, but are
instead Microsoft extensions which should not be used when ANSI
portability is desired.
The optional prefix l indicates that the long version of the
following type is expected, and the corresponding argument should
point to a long or double object. Similarly, the prefix h
specifies the short version. The l and h modifiers can be used
with the d, i, n, o, x, and u type characters. The l modifier can
also be used with the e, f, and g type characters. The l and h
modifiers are ignored if specified for any other type.
The list below demonstrates the use of N, F, l, and h:
Program Code Action
scanf( "%Ns", &x ); Read a string into near memory
scanf( "%Fs", &x ); Read a string into far memory
scanf( "%Nd", &x ); Read an int into near memory
scanf( "%Fd", &x ); Read an int into far memory
scanf( "%Nld", &x ); Read a long int into near memory
scanf( "%Fld", &x ); Read a long int into far memory
scanf( "%Nhp", &x ); Read a 16-bit pointer into near memory
scanf( "%Nlp", &x ); Read a 32-bit pointer into near memory
scanf( "%Fhp", &x ); Read a 16-bit pointer into far memory
scanf( "%Flp", &x ); Read a 32-bit pointer into far memory
-♦-