DDS Developers Documentation → Fortran API → sscanf


Index
fdds_addaxis
fdds_align
fdds_axis_prod
fdds_binfd
fdds_calloc
fdds_calloc8
fdds_check
fdds_close
fdds_closepr
fdds_closepr2
fdds_copy
fdds_count
fdds_datadefn
fdds_dict
fdds_errors
fdds_fflush
fdds_free
fdds_genus
fdds_get
fdds_history
fdds_in
fdds_index
fdds_info
fdds_initmpi
fdds_initmpix
fdds_initopenmp
fdds_isreg
fdds_key
fdds_lseek
fdds_lseek8
fdds_malloc
fdds_malloc8
fdds_map
fdds_member
fdds_memuse
fdds_mod
fdds_name
fdds_newer
fdds_next
fdds_object
fdds_offset
fdds_open
fdds_openm
fdds_openpr
fdds_out
fdds_parent
fdds_prec
fdds_prev
fdds_prime
fdds_printf
fdds_printt
fdds_printv
fdds_prtcon
fdds_prterr
fdds_prthdr
fdds_prtmsg
fdds_ptr
fdds_put
fdds_read
fdds_readm
fdds_realloc
fdds_realloc8
fdds_rmaxis
fdds_savepr
fdds_scale
fdds_scanf
fdds_scank
fdds_scant
fdds_scantn
fdds_scanv
fdds_sprintf
fdds_sscanf
fdds_switch
fdds_write
fdds_writem

fdds_sscanf - retrieve values from a character string


SYNOPSIS

#include <fdds.h> (fixed-format sources)
#include <f90dds.h> (free-format sources)

integer function fdds_sscanf(str, fmt, ...)

character*(*) str
character*(*) fmt

DESCRIPTION

fdds_sscanf retrieves values from a character string. It is controlled by a format string and optional arguments. Processing begins at the beginning of the character string. Characters are matched and converted, as specified by the ANSI C standard for the stdio scanf function. The current position is advanced as the format is processed. The function returns the number of arguments converted and assigned. It returns EOF, if conversion fails prior to the first assignment.

fmt and optional arguments control the processing of definition values. The rules correspond to the scanf function in the ANSI C standard.

Format strings MUST be terminated with a null character ('\0').

The following table summarizes conversion specifiers recognized within fmt, but see the "C" manual for more detail.

fmt                     modifiers
char      Data type   h     l      L          *         I/O type
----      ---------   --------------------------------  --------------------
 u        integer     short long   longlong   suppress  unsigned
 d        integer     short long   longlong   suppress  decimal
 o        integer     short long   longlong   suppress  octal
 x        integer     short long   longlong   suppress  hexadecimal
 i        integer     short long   longlong   suppress  dec,oct,hex
 n        integer     short long   longlong   suppress  (returns # characters)
 c        characters  NA    NA     NA         suppress  (reads spaces also)
 s        string      NA    NA     NA         suppress  (skips initial spaces)
 p        pointer     NA    NA     NA         suppress
 e, f, g  real        NA    double longdouble suppress
 [...]    character   NA    NA     NA         suppress
 [^...]   character   NA    NA     NA         suppress
 %        NA          NA    NA     NA         NA        (literal "%")
    
fdds_sscanf pads trailing blanks or truncates strings as needed during '%c', '%s' and '%[...]' conversion. Unlike "C", the maximum field width is not required to prevent string overflow.

EXAMPLES

!     default "alpha" to 3.14, override if defined
      n = 0
      beta = ' '
      alpha = 3.14
      ier = fdds_sscanf(card, '%f %s %d\0', alpha, beta, n)
    

SEE ALSO

fdds_scanf Scanf DDS dictionary definitions
    

AUTHOR

Jerry Ehlers, EPTG (June, 2009)
For additional help, open an issue here