|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
modifying MSVC++6.0 included header files
stdlib.h has the function itoa(), which converts an integer into a character array - I was wondering, how would I go about finding the source code for this function so I could modify it? I would like to make it into a ftoa, float to array.
stdlib.h includes: Code:
_CRTIMP char * __cdecl _itoa(int, char *, int); but I can't find the source code for it - does MS hide it? |
|
#2
|
||||
|
||||
|
There's no need to write an ftoa function. sprintf() is your friend here.
Code:
sprintf(buf, "%f", float_val); |
|
#3
|
||||
|
||||
|
Also, to answer your question about the source code for itoa(), the source for the lib functions comes with the enterprise edition IIRC (and I don't think it's installed by default either). With all other editions, you just get the compiled object code, included in the lib files. We had a discussion about how libs are built, a while ago. See http://forums.devshed.com/showthrea...&threadid=49606 for more
. |
|
#4
|
|||
|
|||
|
Quote:
so um, at the risk of sounding stupid, how do I use that command? I want to convert the float value in tmpRec[iA].getCost() into a character array. I know that I would put my function call in the 3rd parameter, but what goes in the other 2? |
|
#5
|
||||
|
||||
|
Something like this:
Code:
char buf[100]; sprintf(buf, "%f", tmpRec[iA].getCost()); |
|
#6
|
|||
|
|||
|
Thanks, you just helped me get 50 extra credit points in my class :P
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > modifying MSVC++6.0 included header files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|