RE: how to print out a floating value...
- From: Bill T <BillT@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 4 Dec 2008 07:48:01 -0800
Daniel,
I just built the following code with evc++ 4.0 and ran it successfully on a
CEPC. This is essentially what you are doing.
BT
// GCVTTest.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
int WINAPI WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
char buffer[50];
double source = -3.1415e5;
_gcvt( source, 7, buffer );
printf( "source: %f buffer: '%s'\n", source, buffer );
_gcvt( source, 7, buffer );
printf( "source: %e buffer: '%s'\n", source, buffer );
return 0;
}
"daniel" wrote:
Hi?.
I added the following codes which are from pb's help document to my bsp code.
But it seems the char, double type can't be available. there happens a
compile error.
error C2143: syntax error : missing ';' before 'type'
How can I solve this problem?
#include <stdlib.h>
#include <stdio.h>
....
char buffer[50];
double source = -3.1415e5;
_gcvt( source, 7, buffer );
printf( "source: %f buffer: '%s'\n", source, buffer );
_gcvt( source, 7, buffer );
printf( "source: %e buffer: '%s'\n", source, buffer );
"Bill T" wrote:
Another option is to use *_gcvt( double value, int digits, char* buffer );
BT
"daniel" wrote:
Hi?
I found a floating point value couldn't be printed out from ce os.
The following code is from
\PUBLIC\COMMON\OAK\DRIVERS\SDCARD\SDCLIENTDRIVERS\SDMEMORY\sdmemdiskio.cpp
DEBUGMSG(SDCARD_ZONE_INIT, (TEXT("SDMemCalcDataAccessClocks: Tpd:%f ns,
Asynch: %f ns, AsyncClocks:%d , SyncClocks: %d, ReadTotal: %d, Write Factor:
%d WriteTotal: %d \n"),
clockPeriodNs,
....));
But the real print out message is like following @@
SDMemCalcDataAccessClocks: Tpd:f ns, Asynch: f ns, AsyncClocks:0 ,
You can see the value is not printed out but 'f' is printed instead!
What's wrong??
If I wanna print out some floating point value, how should I do?
- References:
- how to print out a floating value...
- From: daniel
- RE: how to print out a floating value...
- From: Bill T
- RE: how to print out a floating value...
- From: daniel
- how to print out a floating value...
- Prev by Date: Re: how to print out a floating value...
- Next by Date: Re: How to show/hide cursor on attach/deattach usb mouse
- Previous by thread: RE: how to print out a floating value...
- Next by thread: Bug in screen.cpp
- Index(es):
Relevant Pages
|