AnsiString a="1234567890";
long b=a.ToInt();//我测试过了,B=1234567890,在INT范围内
long c=a.ToIntDef(100);//C=1234567890
一下是BCB对类型的定义,你自己看一下,就知道1234567890可以存放在INT和LONG类型里
32-bit data types, sizes, and ranges
Type Size (bits) Range Sample applications
unsigned char 8 0 <= X <= 255 Small numbers and full PC character set
char 8 -128 <= X <= 127 Very small numbers and ASCII characters
short int 16 -32,768 <= X <= 32,767 Counting, small numbers, loop control
unsigned int 32 0 <= X <= 4,294,967,295 Large numbers and loops
int 32 -2,147,483,648 <= X <= 2,147,483,647 Counting, small numbers, loop control
unsigned long 32 0 <= X <= 4,294,967,295 Astronomical distances
enum 32 -2,147,483,648 <= X <= 2,147,483,647 Ordered sets of values
long 32 -2,147,483,648 <= X <= 2,147,483,647 Large numbers, populations
float 32 1.18牋10^-38 < |X| < 3.40牋10^38 Scientific (7-digit) precision)
double 64 2.23牋10^-308 < |X| < 1.79牋10^308 Scientific (15-digit precision)
long double 80 3.37牋10^-4932 < |X| < 1.18牋10^4932 Financial (18-digit precision)