Jump to content
Neil

Sprintf32 Bug?

Recommended Posts

Hi All

 

I think this shows a lib / compiler bug. If you run this code in the debuger (and on a real PIC18F) then the 32 bit function produces an error.

 

sprintf32 gives 999

sprintf gives 9999

 

So, sprintf32 misses out one digit. It only seems to do this for numbers over 99. I have not looked at negative numbers

 

Can this be confirmed as a bug? If so can it be fixed?

 

Thanks

 

Neil

 

OS XPpro, BoostC++ 6.90 PIC18f8722

 

 

	char buf[64];
char* bufP = buf;

unsigned long tl = 9999;
sprintf32(bufP, "%d", tl);

unsigned int ti = 9999;
sprintf(bufP, "%d", ti);

 

I know I dot need bufP but this helps the debugger show the text string in the watch window.

 

 

I have now compiled the sprintf32 code in libc and this works just fine for me.

Edited by Pavel
fixed "funny" characters in the sample code

Share this post


Link to post
Share on other sites

This is the only reference to sprintf32 I can find.

When I try and compile using this command I get this error:

 

error: unknown identifier 'sprintf32'

What am I missing here??

 

Thanks,

Robert

Share this post


Link to post
Share on other sites

Hi Robert,

 

The manual says it is included in stdio.h. Have you included this header file into your code ?

 

Cheers

 

Reynard

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...