Jump to content
Sign in to follow this  
johnsuijk

Uitoa_dec Seems To Overwrites Buffer.

Recommended Posts

Hi,

 

function uitoa_dec seems to overwrites buffer.

 

#include <system.h>
#include <boostc.h>
#include <stdlib.h>


#pragma DATA _CONFIG, _CP_OFF & _WDT_OFF & _MCLRE_OFF & _INTOSCIO & _PWRTE_ON & _BOR_ON
#pragma CLOCK_FREQ 8000000




void main()
{
char buf[4];
unsigned int a;
unsigned int b;

a=3;
b=4;

uitoa_dec(  buf, b,  4 );	

// BUG ???? a=0 but should be 3

}

 

 

 

IDE version: SourceBoost IDE 6.60

Compiler: BoostC

Target device: PIC16F690

OS: Windows XP

Share this post


Link to post
Share on other sites

johnsuijk,

 

function uitoa_dec seems to overwrites buffer.

Not a bug :)

This function produces a null terminated string so needs one more character in the buffer than the number of digits specified - documentation needs more detail.

 

Regards

Dave

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...