Questions about itoa function may have this tag. Despite being supported by some compilers, this function is not defined in ANSI-C and it is not part of C++.
Questions tagged [itoa]
94 questions
1
vote
2 answers
Unhandled Exception when using itoa
Below is a part of my code. I am not sure what is wrong with it because when I debug this code, I get a the following error:
Unhandled exception at 0x60e8144c (msvcr90d.dll) in client0.exe:
0xC0000005: Access violation writing location…

Ayse
- 2,676
- 10
- 36
- 61
1
vote
2 answers
itoa to std::to_string
This may be a vaugue question but im getting this error
Simulator.cpp: In member function `void Simulator::generatePassengers()':
Simulator.cpp:60: error: `itoa' undeclared (first use this function)
This is the code im having an issue…

soniccool
- 5,790
- 22
- 60
- 98
1
vote
2 answers
itoa replace to std::to_string how to
How can i replace this
itoa(i, buf, 10);
key1.append(buf);
key2.append(buf);
key3.append(buf);
with std::to_string
itoa was giving me an error it was not declared in scope that its not part of standard
I heard i can use…

soniccool
- 5,790
- 22
- 60
- 98
1
vote
2 answers
custom ITOA not working right?
I wanted to make a custom ITOA function to put large numbers into small strings, this is what I have coded :
main(){
printf("itoa(2000000000,36)= '%s'",itoa(2000000000,36));
printf("itoa(36,36)= '%s'",itoa(36,36));
printf("itoa(37,36)=…
user1182183
1
vote
3 answers
'itoa' : function does not take 1 arguments & 'c' : undeclared identifier
I've been trying for 2 days now to get this code to work. It's just been error after error.
Can anyone point out what i'm doing wrong?
#include "stdafx.h"
#include
#include
using namespace std;
int main()
{
int h = 0;
…

Leinad177
- 51
- 1
- 7
0
votes
4 answers
What is the best practice of using itoa()
When I use itoa() it needs a char* _DstBuff, what is the best practice here?
#include "stdafx.h"
#include
using namespace std;
int main()
{
int num = 100;
// I'm sure here is no memory leak, but it needs to know the length.
char…

shengy
- 9,461
- 4
- 37
- 61
0
votes
3 answers
itoa creates an infinite loop in C++
This is very strange. itoa(); seems to create an infinite loop.
for(int i = 0; i < 10; i++)
{
char buffer[1];
itoa(i, buffer, 10);
std::cout << buffer;
}
Why on earth does it do that? I've tried using different variables…

Griffin
- 644
- 6
- 18
0
votes
2 answers
itoa in a template function
Code goes first:
template
void do_sth(int count)
{
char str_count[10];
//...
itoa(count, str_count, 10);
//...
}
but I got some compile-error like this:
error: there are no arguments to ‘itoa’ that depend on a template…

Alcott
- 17,905
- 32
- 116
- 173
0
votes
2 answers
Integer number as char* for dummies
Question has been asking before, but I am still a bit at a loss as to the best way. I have an integer and would like to obtain a char* to use as a member of a struct.
Similar questions are for example
here or here.
I'd rather not use stringstream…

Cookie
- 12,004
- 13
- 54
- 83
0
votes
1 answer
inteager to argument in C; gdb shows no errors, function is not giving output
**
Hello :)
So I have this task to write a program that will convert int to arg using malloc and well it all works fine, gdb shows no errors, but it is not printing any output in this form. If i delete itoa_buffer[i] = '\0'; than sometimes it shows…

Tony
- 25
- 1
- 6
0
votes
1 answer
why 1 is getting added at the end of string? in this code
I want to create a text file with the name entered by the user and with id concatinated,The file is getting created but the 1 is getting added at the last of extension every time i run it
#include "stdio.h"
#include "string.h"
#include…

Aviroxi
- 115
- 1
- 9
0
votes
1 answer
How to print signed integer in x86 assembly (NASM) on Mac
I found an implementation of unsigned integer conversion in x86 assembly, and I tried plugging it in but being new to assembly and not having a debugging env there yet, it's difficult to understand why it's not working. I would also like it to work…

Lance
- 75,200
- 93
- 289
- 503
0
votes
5 answers
Problem with concatenation + itoa
I have the following code:
char stringHour[50], stringMinute[50], stringSecond[50];
// lots of code...
itoa(hour, stringHour, 10);
itoa(minute, stringMinute, 10);
itoa(second, stringSecond, 10);
strcat(":", stringSecond);
strcat(":",…

F. P.
- 5,018
- 10
- 55
- 80
0
votes
1 answer
Arduino: itoa prints 201 and sprintf prints the intended 99
I have difficulties printing a byte value (uint8_t) with itoa(), needed to print a percentage of volume. I want to use this function because it reduce binary size.
Two versions of an updateStats function (prints stats on a oled display using…

Codebeat
- 6,501
- 6
- 57
- 99
0
votes
1 answer
itoa function for byte array
Is there an easy way to do the following:
Convert a byte array like so {1,3,0,2,4} to a char array like so {'1','3','0','2','4'} or "13024".
I can do the following ( I think ) but it is more cumbersome:
…
user3493202