October 23rd, 2003, 09:00 PM
|
#2 (permalink)
|
| Member
Join Date: Apr 2002 Location: Georgia
Posts: 137
| Re: ignorant student needs help w/ C Quote: Originally posted by allenericc Is there a way to convert char[] of 40 single digits into a double, process it, then break it back up into individual digits and store it back in the char[]? I know it sounds simple enough but I can't figure it out.
I've tried to use atof() and then sprintf(), but can't even get the right value out of atof().
Please help.
Thanx,
Eric | I think you'd just do something like
char characters[40];
/*Initialize the character array in some way*/
double* dubnum;
dubnum=(double*)characters;
/*Do whatever the hell you want with dubnum as a double, remembering to dereference it first, and then, when you are finished, as a side-effect, characters will already be your 40 character array, worked on by the processes you were using on the double*/
If that doesn't work, then tell me what you are trying to do because otherwise I'm confused.
__________________
Jüš† ä €öm¶ù†Ê® §ÇÌÈñŒ mÅjÒ®
|
| |