May 14, 2019
03:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 14, 2019
03:58 AM
Greetings all,
Does the DAVE4 'C code' compiler support the Wildcard character * for the Width and Precision fields in the "printf" & "sprint" functions ?
For example...
int16_t Width = 5;
int16_t Precision = 3;
float Number = 1.23456;
sprintf( pBuff, "%*.*f", Width, Precision, Number );
I have tried this but the result is an empty string instead of "1.234"
Thank you very much
PHAB
Does the DAVE4 'C code' compiler support the Wildcard character * for the Width and Precision fields in the "printf" & "sprint" functions ?
For example...
int16_t Width = 5;
int16_t Precision = 3;
float Number = 1.23456;
sprintf( pBuff, "%*.*f", Width, Precision, Number );
I have tried this but the result is an empty string instead of "1.234"
Thank you very much
PHAB
- Tags:
- IFX
2 Replies
May 14, 2019
04:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 14, 2019
04:32 AM
OK, it seems like I haven't enabled the "Add floating point support for printf" in the "Runtime Library" section for the Microcontroller. Not sure how I do this retrospectively as the option is greyed out.
May 14, 2019
04:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 14, 2019
04:49 AM
Yes the wildcard Width and Precision specifiers are supported.
Instructions for enabling the "Add floating point support for printf" in the "Runtime Library" section for the Microcontroller can be found here...
https://www.infineonforums.com/threads/6632-How-to-enable-the-Add-floating-point-support-for-printf-...
Instructions for enabling the "Add floating point support for printf" in the "Runtime Library" section for the Microcontroller can be found here...
https://www.infineonforums.com/threads/6632-How-to-enable-the-Add-floating-point-support-for-printf-...