I have found the answer. I used the function itoa(). Here is an example:
#include <stdio.h>
#include <stdlib.h>
int main() {
char str[10]; /* MUST be big enough to hold all the characters of your number!! */
printf("15 in binary is %s\n", itoa(15, str, 2))...
my overall goal is to sort hexidecimal numbers. My problem is converting from long int to hex and saving my data in hex format so that I may sort it in that format. For example:
long num = 1030507233;
How do I convert and save this? I know that the hex value is 3d6c4ea1 because I can...
I am trying to read in a line of integers. The file is like this:
4
3
0 0 1 0
0 1
2 3
3 4
4 0
the first two #s are fine, but lines 3-7 are giving me problems. How can I read each # in line 3 individually and perform some stuff on it, then continue to read the rest of the numbers and doing...
I am trying to read in a line of integers. The file is like this:
4
3
0 0 1 0
0 1
2 3
3 4
4 0
the first two #s are fine, but lines 3-7 are giving me problems. How can I read each # in line 3 individually and perform some stuff on it, then continue to read the rest of the numbers and doing...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.