Re: Decimal point problem?
- Posted by don cole <doncole at pacbell.net> Jun 08, 2006
- 590 views
Larry Miller wrote: > > don cole wrote: > > > > Hello everybody, > > > > These are movie sizes in bytes. > > When use the following code > > > > setText(MOV_LOCS2[x],info[2]) > > ?info[2] > > The console window prints 77782668 (which is what I want) > > But the EditText prints 7.77827e (which I don't want) > > Why? > > > > Don Cole > > > I am assuming that you are using Win32Lib. > The problem is caused by the default format string that setText() uses when > the second parameter is a number. It uses "%g" as the format string, which > will > use an exponent in some cases. Check the documentation for printf(). Win32Lib > does allow providing a format string, although this does not appear to be > documented. > If the parameter is a 2 element sequence, with the first element being a > sequence, > it will be used as the format string. > > You would then use: > setText(MOV_LOCS2[x],{"%d",info[2]}) > This will always display as an integer. > > I learned this from looking at Win32Lib itself. > > Larry Miller Thanks Larry, That solves it. Actually it's going to be setText(MOV_LOCS2[x],{"%d",info[2]/1000}) for Kbs. But I didn't want to go into that untill I got the basic number right. Don Cole Bonds > Ruth. Giants STILL in last place Hmmmmmmmm! Don Cole