// filename:c2011-K-3-5-3-2-ex.c
// original examples and/or notes:
// 		(c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011
// 			C2011 K.3.5.3.2 The fscanf_s function
// compile and output mechanism:
// 		(c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013
// compile errors and/or wornings:
// 		(c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
// 			Target: x86_64-apple-darwin11.4.2 //Thread model: posix
// 		(c) LLVM 2003-2009 University of Illinois at Urbana-Champaign.
// Example 1
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stddef.h>
#include <math.h>

int main(void)
{
/* ... */
int n, i; float x; char name[50];
n = fscanf_s(stdin, "%d%f%s", &i, &x, name, (rsize_t) 50);
printf( "%d%f%s\n", i, x, name, (rsize_t) 50);

// Example 2

/* ... */
//	int n; 
	char s[5];
	n = fscanf_s(stdin, "%s", s, sizeof s);
printf( "%s %d \n", s, sizeof s);	
	
return printf("K.3.5.3.2 The fscanf_s function \n");
}
// output may be 