Interpréter une chaîne de caractères comme une valeur numérique de type long

Author:


{filelink=13221}

/*

 long double strtold ( const char * restrict s , char ** restrict endptr   );  (C99)

*/

  #include 
  #include 
  #include 

  int main(void)
  {
	char in[1024], *start = in, *next = in;
	long val;
	puts( "Taper un nombre à virgule:" );
	scanf( "%[^n]", in );

	puts( "Vous avez entré:" );
	while ( 1 )
	{
	 val = strtold( start, &next );
	if ( next == start )
        break ;
	printf( "t%gn", val );
	start = next;
}
puts( "Done." );

    return 0;
  }

Leave a Reply

Your email address will not be published. Required fields are marked *