I'm using c_str()
, atoi
and atof
functions for converting string variables to integer or float/double.
For example,
val = atoi(val1.c_str());
val = atof(val1.c_str());
So, I would like to know if I need to include and . Thanks.
I'm using c_str()
, atoi
and atof
functions for converting string variables to integer or float/double.
For example,
val = atoi(val1.c_str());
val = atof(val1.c_str());
So, I would like to know if I need to include and . Thanks.
None of those require the header <cstring>
. The function c_str()
requires <string>
and including <cstdlib>
(the C++ version of the <stdlib.h>
header) guarantees you have std::atoi
and std::atof
.
Also, the site cplusplus.com is not necessarily the best reference, you should probably use cppreference.com