As far as I know, no standard functions begin with a "_", and I think I read somewhere that you should never define things beginning with "_" because they could clash with implementation specific variables, functions, macros, classes...
Printable View
As far as I know, no standard functions begin with a "_", and I think I read somewhere that you should never define things beginning with "_" because they could clash with implementation specific variables, functions, macros, classes...
There is both itoa and _itoa, while the doc says _itoa is the ISO standard and itoa is deprecated in VC++ 2005.
You can still use the non _ version of all those "deprecated" functions.
If/when they force you to call their _ version, I would just redefine them all myself:
Code:#ifdef WIN32
# define open _open
# define O_APPEND _O_APPEND
# define O_BINARY _O_BINARY
...
#endif
this came from the reverse of atoi.. intuitive for ppl who already know atoi as its mostly used
long ago I had the same prob..
but after googling itoa is not a standard but implemented in few compilers and headers as macro(mostly for windows)..
spritnf is better and standard.
got another question now ... noob as I am ...
What if I want to convert back from a char to int again. my code
How do I get a to 10?Code:char buf[] = "10";
int a;
a = ??
a = buf[0];//gives the ascii code for 1
a = buf[1];//gives the ascii code for 0
Use atoi, if such a function exists.
Or strtol() would be better, it has improved error diagnostics.
sscanf() will also work.