你定义的str[1000]就是假定程序可以转换出1000位的整数嘛,不然弄那么大干什么。										
					
	
	
	
			
授人以渔,不授人以鱼。
 2014-11-27 16:45
	    2014-11-27 16:45
   2014-11-27 17:37
	    2014-11-27 17:37
   程序代码:
程序代码:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main(void)
{
    printf_s("%d\n", atoi("123456789"));
    _getch();
    return EXIT_SUCCESS;
}

 2014-11-27 18:46
	    2014-11-27 18:46
   程序代码:
程序代码:
// crt_atoi.c
// This program shows how numbers
// stored as strings can be converted to
// numeric values using the atoi functions.
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
int main( void )
{
    char    *str = NULL;
    int     value = 0;
    // An example of the atoi function.
    str = "  -2309 ";
    value = atoi( str );
    printf( "Function: atoi( \"%s\" ) = %d\n", str, value );
    // Another example of the atoi function.
    str = "31412764";
    value = atoi( str );
    printf( "Function: atoi( \"%s\" ) = %d\n", str, value );
    // Another example of the atoi function
    // with an overflow condition occuring.
    str = "3336402735171707160320";
    value = atoi( str );
    printf( "Function: atoi( \"%s\" ) = %d\n", str, value );
    if (errno == ERANGE)
    {
       printf("Overflow condition occurred.\n");
    }
}

 2014-11-27 18:50
	    2014-11-27 18:50
   2014-11-27 18:55
	    2014-11-27 18:55
  
 2014-11-27 20:52
	    2014-11-27 20:52