Reputation: 1099
I need to append \t to an integer of 4 bytes.Initially integer variable is assigned a value and which has to be appended with \t and transmitted .In the receiver side the integer and \t has to be separated. I have used itoa() and atoi() to convert from integer to string and vice-versa. Code:
int integer=10;
char string[5];
itoa(integer,string,10);
I am getting error as undefined reference to 'itoa'. Is there any alternative to do so and how to recover the \t from the integer...Kindly help me in this regard. Thanks in advance
Upvotes: 0
Views: 573
Reputation: 1980
You have to use
char string[5];
int integer= 10;
snprintf(string, 5,"%d",integer);
Because itoa
is not part of the standard function which is supported by some compilers..
Upvotes: 3