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
3 answers

itoa providing 7-bit output to character input

I am trying to convert a character to its binary using inbuilt library (itoa) in C(gcc v-5.1) using example from Conversion of Char to Binary in C , but i'm getting a 7-bit output for a character input to itoa function.But since a character in C is…
harry
  • 11
  • 3
0
votes
3 answers

How do you properly implement turning an int into a string?

I am writing a bit of an operating system, and I require the ability to print the addition of a variable. I have a working atoi function and so I reversed it to give me an itoa function. There is no way to access free memory, so I need to figure out…
Dylan Turner
  • 322
  • 1
  • 12
0
votes
1 answer

Which library do I have to download in order to get itoa() in C

I want to use itoa() in C . Which library do I have to download? I would prefer to include a specific library instead of using my own code, but that may be wrong. I have seen several examples of how to use itoa() but my problem is how to get the…
0
votes
1 answer

Append unsigned char* to unsigned char*

I'd like to append an unsigned char* to another unsigned char* to create a long string that can be returned to a parent function and parsed. I have the following: unsigned char *bytes = NULL; unsigned char *retVal = NULL; int intVal1,…
txcotrader
  • 585
  • 1
  • 6
  • 21
0
votes
1 answer

Itoa and different character sets c++ visual studio 2013

My code: m_ListCtrlCandidates.InsertItem(i, _itoa_s(candidate[i].ID, (char*)(LPCTSTR)str, 10)); m_ListCtrlCandidates.SetItemText(i, 1, _itoa(candidate[i].FingerNumber, (char*)(LPCTSTR)str, 10)); m_ListCtrlCandidates.SetItemText(i, 2,…
user4342836
  • 43
  • 2
  • 10
0
votes
1 answer

How can I get the atoi() function to work on a string?

int p; long unsigned int z; while (i <= x.length()) { const int a = x.length(); char* b; b = x.substr(sizeof(a) - i, 1); p = atoi(b); z = (z + p + 3) * 3; i++; } I'm getting: C:\Users\Anthony\Downloads\pack1.cpp|77|error:…
thexiv
  • 27
  • 9
0
votes
2 answers

any alternative of itoa converting integer in base 2 to string?

as we know itoa tries to convert an integer in any base but to char array which has fix size, I am trying to find an alternative which can do the same work but convert to string with base 2 in c++.
0
votes
1 answer

How to use itoa in C

Can anybody tell me how to use itoa function in C? The prototype is: char*itoa(int_Val,char*_DstBuf,int_Radix) I think that int_Val is the value that I want to convert char*_DstBuf, is the string where I want to store the result But what is…
user3577832
  • 23
  • 1
  • 6
0
votes
1 answer

Problems with itoa

I am trying to send some data from an micro controller to the PC. The data is 10 bit ADC conversions(e.g numbers from 0-1023) from different ports. I have saved this number as an integer and I would now want to transform this to an ascii string…
Henrik
  • 405
  • 1
  • 8
  • 19
0
votes
3 answers

C++ standard alternative to itoa() to convert int to base 10 char*

To convert an integer to base 10 char* std::itoa(ConCounter, ID, 10); ConCounter is an integer, ID is a char*, and 10 is the base It says that iota is not a member of std and without std it's not declared. I know it's a nonstandard function but I…
nurtul
  • 274
  • 1
  • 9
  • 19
0
votes
1 answer

How do I read binary data, convert it to an int, then convert it back in C++?

I'm trying to open a wav file, read it, convert the buffer to an integer array, then convert it back and write it. int main(){ ifstream file ("C:\\Documents\\ParadigmE3-shortened.wav",std::ios_base::out | std::ios_base::binary); char *…
JVE999
  • 3,327
  • 10
  • 54
  • 89
0
votes
1 answer

itoa function does not work for single digit integers

I have a custom itoa function that works for integers 10 and greater, but for some reason it returns nothing if the integer passed is a single digit. I can't seem to figure out why that is. When I print the array after it has been reversed by…
LazerSharks
  • 3,089
  • 4
  • 42
  • 67
0
votes
1 answer

Converting from int to byte array then back to int using atoi and itoa on Arduino for transmission

I am converting an signed int to send over Arduino Wire as multiple bytes so I did the following: The code below is the debugging of my implementation, you can copy into the Arduino IDE to see printout. What I cant understand is how itoa creates an…
frazras
  • 5,928
  • 4
  • 30
  • 40
0
votes
2 answers

itoa in C using Codeblocks causes segmentation error

Been playing with itoa() for a school project and it was working fine then started to throw errors. Says its having a segmenation error when first instance of itoa is handled. Here's the offending code. I don't see why it would work at first then…
Chef Flambe
  • 885
  • 2
  • 15
  • 35
0
votes
3 answers

i have some problems with C in xcode

I am using use Microsoft Visual Studio to learn C, I wrote some code, it's work well. But when I tried to debug with xcode, it doesn't work. this is my error in xcode Here is my code for convert a number to roman numeral: #include…
user1907096
  • 19
  • 1
  • 2