In the transmission of the serial slave, it may be used to send a number, displayed as a string type of
And the previous text, "String of strings into integer" a positive and reverse, knowledge point learning will be:
#include <iostream.h>
#include <stdio.h>
#include <string.h>
void IntToStr (int m,unsigned char * str)
{int length=0;
int tmp,temp; Temp variable
Temp=m; Integer value entered on first scan
while (temp! = 0)
{
temp = TEMP/10;
length++;
}
str[length]= ' + ';
length--;
while (length >= 0)//The low position of the digits into the high position of the array
{
TMP = M%10;
str[length--] = 0x30|tmp;
m = M/10;
}
}
void Main ()
{unsigned char str[10];
int m=12345;
IntToStr (M,STR);
printf ("Input integer number:%d\n", m);
printf ("Output string is:%s\n", str);
}
//------------------------------------------------------------------------------------------------------
Integer conversions to String functions:
Verify:
VC environment to convert the integer type to string type (2)