Main Page Modules

# Formatted Scanning Functions.

Variations of formatted scanning functions. More...

## Functions

int | trio_scanf (const char *format,...)
| Scan characters from standard input stream.
int | trio_vscanf (const char *format, va_list args)
| Scan characters from standard input stream.
int | trio_scanfv (const char *format, trio_pointer_t *args)
| Scan characters from standard input stream.
int | trio_fscanf (FILE *file, const char *format,...)
| Scan characters from file.
int | trio_vfscanf (FILE *file, const char *format, va_list args)
| Scan characters from file.
int | trio_fscanfv (FILE *file, const char *format, trio_pointer_t *args)
| Scan characters from file.
int | trio_dscanf (int fd, const char *format,...)
| Scan characters from file descriptor.
int | trio_vdscanf (int fd, const char *format, va_list args)
| Scan characters from file descriptor.
int | trio_dscanfv (int fd, const char *format, trio_pointer_t *args)
| Scan characters from file descriptor.
int | trio_sscanf (const char *buffer, const char *format,...)
| Scan characters from string.
int | trio_vsscanf (const char *buffer, const char *format, va_list args)
| Scan characters from string.
int | trio_sscanfv (const char *buffer, const char *format, trio_pointer_t *args)
| Scan characters from string.

## Detailed Description

Variations of formatted scanning functions.

SYNOPSIS

    cc ... -ltrio -lm

    #include <trio.h>

DESCRIPTION

This documentation is incomplete. The documentation of the scanf family in [C99] and [UNIX98] also applies to the trio counterparts.

SCANNING

The scanning is controlled by the format string. The format string can contain normal text and conversion indicators. The normal text can be any character except the nil character (\000) and the percent character (\045 = '%'). Conversion indicators consists of an indication character (%), followed by zero or more conversion modifiers, and exactly one conversion specifier.

Modifiers

Positional ( `9$` ) [UNIX98]

See Formatted Printing Functions..

Specifiers

Percent ( `%` )

Character ( `c` )

Decimal ( `d` )

Floating-point ( `a`, `A`, `e`, `E`, `f`, `F`, `g`, `G` )

Integer ( `i` )

Count ( `n` )

Octal ( `o` )

Pointer ( `p` )

String ( `s` )

Unsigned ( `u` )

Hex ( `x`, `X` )

Scanlist ( `[]` )

Scanlist Exclusion (`^` )

Scanlist Range ( `-` ) [TRIO]

- Only increasing ranges, i.e. `[a-b]`, but not `[b-a]`.
- Transitive ranges, ie. `[a-b-c]` equals `[a-c]`.
- Trailing minus, ie. `[a-]` is interpreted as an `a` and a `-`.
- Duplicates are ignored.

Scanlist Equivalence Class Expression ( `[`= =`]` ) [TRIO]

Locale dependent (LC_COLLATE). Only one expression can appear inside the delimiters.

- `[=a=]` All letters in the same equivalence class as the letter `a`.

        trio_scanf("%[[=a=]b]\n", buffer);
        trio_scanf("%[[=a=][=b=]]\n", buffer);

Scanlist Character Class Expression ( `[`: :`])` [TRIO] Locale dependent (LC_CTYPE). Only one expression can appear inside the delimiters.

- `[:alnum:]` Same as `[:alpha:]` and `[:digit:]`
- `[:alpha:]` Same as `[:lower:]` and `[:upper:]`
- `[:cntrl:]` Control characters
- `[:digit:]` Decimal digits
- `[:graph:]` Printable characters except space
- `[:lower:]` Lower case alphabetic letters
- `[:print:]` Printable characters
- `[:punct:]` Punctuation
- `[:space:]` Whitespace characters
- `[:upper:]` Upper case alphabetic letters
- `[:xdigit:]` Hexadecimal digits

        trio_scanf("%[[:alnum:]]\n", buffer);
        trio_scanf("%[[:alpha:][:digit:]]\n", buffer);

RETURN VALUES

SEE ALSO

Formatted Printing Functions.

## Function Documentation

int trio_dscanf | ( | int | fd,
|  | const char * | format,
|  | ... |
| ) |

Scan characters from file descriptor.

Parameters:

  fd | File descriptor.
  format | Formatting string.
  ... | Arguments.

Returns:
  Number of scanned characters.

int trio_dscanfv | ( | int | fd,
|  | const char * | format,
|  | trio_pointer_t * | args
| ) |

Scan characters from file descriptor.

Parameters:

  fd | File descriptor.
  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_fscanf | ( | FILE * | file,
|  | const char * | format,
|  | ... |
| ) |

Scan characters from file.

Parameters:

  file | File pointer.
  format | Formatting string.
  ... | Arguments.

Returns:
  Number of scanned characters.

int trio_fscanfv | ( | FILE * | file,
|  | const char * | format,
|  | trio_pointer_t * | args
| ) |

Scan characters from file.

Parameters:

  file | File pointer.
  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_scanf | ( | const char * | format,
|  | ... |
| ) |

Scan characters from standard input stream.

Parameters:

  format | Formatting string.
  ... | Arguments.

Returns:
  Number of scanned characters.

int trio_scanfv | ( | const char * | format,
|  | trio_pointer_t * | args
| ) |

Scan characters from standard input stream.

Parameters:

  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_sscanf | ( | const char * | buffer,
|  | const char * | format,
|  | ... |
| ) |

Scan characters from string.

Parameters:

  buffer | Input string.
  format | Formatting string.
  ... | Arguments.

Returns:
  Number of scanned characters.

int trio_sscanfv | ( | const char * | buffer,
|  | const char * | format,
|  | trio_pointer_t * | args
| ) |

Scan characters from string.

Parameters:

  buffer | Input string.
  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_vdscanf | ( | int | fd,
|  | const char * | format,
|  | va_list | args
| ) |

Scan characters from file descriptor.

Parameters:

  fd | File descriptor.
  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_vfscanf | ( | FILE * | file,
|  | const char * | format,
|  | va_list | args
| ) |

Scan characters from file.

Parameters:

  file | File pointer.
  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_vscanf | ( | const char * | format,
|  | va_list | args
| ) |

Scan characters from standard input stream.

Parameters:

  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

int trio_vsscanf | ( | const char * | buffer,
|  | const char * | format,
|  | va_list | args
| ) |

Scan characters from string.

Parameters:

  buffer | Input string.
  format | Formatting string.
  args | Arguments.

Returns:
  Number of scanned characters.

Copyright (C) 2001 - 2006 Bjørn Reese and Daniel Stenberg.