|
Re: vsprintf float bug in GCC(?): msg#00273gcc.help
"Edward Byard" <ed@xxxxxxxxxxxxxxxxx> writes: > Hi, > > I'm having a BIG problem trying to vsprintf float values. > Firstly I should mention that I am compiling for the H8/300 system using gcc > version 2.7-91q1 (yes it's old - nothing I can do about that just yet). > > I have a function called AlphaPrintf which prints to a 16-char long display, > as such: > > void AlphaPrintf(char *String, ...) > { > char AlphaBuf[32]; > va_list VarListPtr; > > va_start(VarListPtr,String); What about va_end ? You must call va_end before you return from AlphaPrintf. (I know the gnu C lib doesn't require that, but other c libs do.) > vsprintf(AlphaBuf,String,VarListPtr); > > AlphaBuf[17] = '\0'; > PrintOnDisplay(AlphaBuf); /* will print until the null is reached (duh!) > */ > } > > I wish to be able to vsprintf a precision value (10.3f) , obtained from > dividing a long int with a > short int, cast to a double like so: > > long int LongIntValue; > short int ShortIntValue; > > float FloatVar1 = LongIntValue/(double)ShortIntValue; > > and I am passing AlphaPrintf this: > > AlphaPrintf("%10.3f",FloatVar1); > [snip] |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: MIPSPro + GCC = ?: 00273, Muthukumar Ratty |
|---|---|
| Next by Date: | Almost have standard crtbegin/end with vxworks/mips gcc 3.2.3: 00273, Ken Faiczak |
| Previous by Thread: | Re: vsprintf float bug in GCC(?)i: 00273, Edward Byard |
| Next by Thread: | Undefined reference to xxx with arm-elf-gcc: 00273, Christian Narvaez |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |