Back to index

glibc  2.9
Functions
scanf9.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int main (void)

Function Documentation

int main ( void  )

Definition at line 6 of file scanf9.c.

{
  int matches;
  char str[10];

  str[0] = '\0';
  matches = -9;
  matches = sscanf ("x ]", "%[^] ]", str);
  printf ("Matches = %d, string str = \"%s\".\n", matches, str);
  printf ("str should be \"x\".\n");

  if (strcmp (str, "x"))
    abort ();

  str[0] = '\0';
  matches = -9;
  matches = sscanf (" ] x", "%[] ]", str);
  printf ("Matches = %d, string str = \"%s\".\n", matches, str);
  printf ("str should be \" ] \".\n");

  if (strcmp (str, " ] "))
    abort ();

  return 0;
}

Here is the call graph for this function: