Questions tagged [itoa]

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++.

94 questions
0
votes
1 answer

print BCD value with itoa

I need to print on screen a variable value that is encoded in BCD. Do you know whether is possible to print it on screen by using itoa? If that is possible, how to do that?
Abruzzo Forte e Gentile
  • 14,423
  • 28
  • 99
  • 173
-1
votes
2 answers

Convert Decimal to Hexdecimal C++

I have this code, but it seems to print only last 4 characters of the hexadecimal conversion. #include #include #include int main () { int i; char test [33]; printf ("Enter a number: "); scanf ("%d",&i); itoa…
user6366379
-1
votes
1 answer

Print string shows symbols

I'm trying to write an ITOA (integer to array) function using pointers. So this is what I got so far. I debugged and it works just fine. The thing is, the printing itself doesn't work. I'm adding two screenshots. Would appreciate some help. int…
-1
votes
2 answers

Why my itoa implementation works only for 3 digit numbers?

I have to to write an implementation of itoa, where the output representation is contained in an array, v for example. The array format must be as follows: v[0] - the length of number (in digits) v[1] ... v[v[0]] - the number's digits, as chars in…
rares985
  • 341
  • 3
  • 15
-1
votes
1 answer

itoa function not working

I want my function "ordenafile" to take candidatos.000 - candidatos.068. For some reason si[0] is bugged i think, cause if I make the program prints si[0], it crashes. Anyone knows why? int i; char…
Syan Souza
  • 149
  • 12
-1
votes
3 answers

What is wrong with my itoa conversion?

Background Im trying to determine character codes for some national diactric letters. Problem Is something is wrong with my code? char a = "a"; // "a" ascii code is 97 char buffer[8]; itoa(buffer,(int)a, 10); print(buffer); // but it prints "252"…
Kamil
  • 13,363
  • 24
  • 88
  • 183
-1
votes
1 answer

_itoa_s kills C++ optimizing compiler all time, why?

I have a code on which the optimizing compiler always fails, with each launch. char* GetWinSockVersion() { char *tmpData = (char*)malloc(sizeof(wsaData.wVersion)); _itoa_s(wsaData.wVersion, tmpData, 10); return…
Secret
  • 2,627
  • 7
  • 32
  • 46
-2
votes
4 answers

Modify itoa to process a floating point string with decimal point operator into ASCII char 23(123.456) in the output

Having trouble C language debug step into process decimal point operator in a floating point sting of numbers. Example: 1234.5678, itoa() output stops at 4 and terminates out array string with '\0' Null char* pointer also an array. So we only get…
-2
votes
1 answer

itoa () does not work on 32bit tdm-gcc 5.1 even on including stdlib.h

I have a made a c++ program which uses itoa (). I compiled it on 64Bit compiler(TDM-GCC-5.1), it compiled and worked. But when i compiled it using 32 bit TDM-GCC-5.1 compiler i get the error itoa () was not declared in this scope. I tried compiling…
Vedant
  • 145
  • 1
  • 13
-2
votes
1 answer

Problems implementing a itoa function with printf and without it

I just write a code for my own itoa (just for positive numbers) and I try to make it as efficient possible, I display the value from inside the function and from main, and it works, but when I remove the printf line from inside the function the…
-2
votes
1 answer

Arduino C function to convert String to HEX?

I am looking for built-in C or C++ function that allows me to convert a float into an HEX string, so far I have used itoa , but it does not work with negative values since it works with unsigned for base 16, so I was wondering which one I could use…
ndarkness
  • 1,011
  • 2
  • 16
  • 36
-2
votes
2 answers

Creating string in C

I'm trying to create in Texas Instrument CCS a string in C like this : {steps: nSteps} in order to send it as a json, nSteps is an int .I want to convert into a string as well with the following code: void jsonSteps(char* stepstr, int steps) { …
user4852783
-2
votes
2 answers

Can someone please tell me what's wrong with this code?

#include #include #include #include #include using namespace std; void OpCode() { string mnemonic; int hex; char *op; cout << "Entre mnemonic : "; cin >> mnemonic; char…
user3002197
  • 191
  • 1
  • 1
  • 4
-2
votes
1 answer

How to store an integer in a single index of character array?

I want to store a single integer in a single index of character array. The itoa function is not working in this case. Can anyone help?
Salman
  • 11
  • 1
-3
votes
1 answer

Unexpected Acess violation (itoa)

In K&R book, there is itoa code in Chapter 3 on 64th page. I tried to compile the code, but i was not successful. Here is the code: #include #include using namespace std; void itoa(int, char*); int main(void) { _getch(); …
Silidrone
  • 1,471
  • 4
  • 20
  • 35