//
// PURPOSE: Determine what happens if sscanf has more arguments than there are
// columns in the string you're trying to read.
//
// cc sscanfTest.cc -o sscanfTest;./sscanfTest
//
#include <stdio.h>

int main()
{
   int i, j, numRead;

   float arg[4] = {-1., -1., -1., -1.};

   char buf[128];

   printf("Intial values:\n");
   for( i=0; i<4; i++ )
      printf(" arg%d = %f\n", i, arg[i]);

   sprintf(buf, "%f %f %f", 1.0, 2.0, 3.0 );

   printf("buf = %s\n", buf);

   numRead = sscanf(buf, "%f %f %f %f", arg, arg+1, arg+2, arg+3 );

   printf("numRead = %d\n", numRead);

   for( i=0; i<4; i++ )
      printf(" arg%d = %f\n", i, arg[i]);

   return 1;
}
