Iztok Jeras
2015-10-07 cb38dba9fe0344b02f4b183152263fe3c0066290
libscpi/src/utils.c
@@ -245,7 +245,18 @@
}
/**
 * Converts double value to string
 * Converts float (32 bit) value to string
 * @param val   long value
 * @param str   converted textual representation
 * @param len   string buffer length
 * @return number of bytes written to str (without '\0')
 */
size_t SCPI_FloatToStr(float val, char * str, size_t len) {
    return SCPIDEFINE_floatToStr(val, str, len);
}
/**
 * Converts double (64 bit) value to string
 * @param val   double value
 * @param str   converted textual representation
 * @param len   string buffer length
@@ -303,9 +314,20 @@
    return endptr - str;
}
/**
 * Converts string to float (32 bit) representation
 * @param str   string value
 * @param val   float result
 * @return      number of bytes used in string
 */
size_t strToFloat(const char * str, float * val) {
    char * endptr;
    *val = strtof(str, &endptr);
    return endptr - str;
}
/**
 * Converts string to double representation
 * Converts string to double (64 bit) representation
 * @param str   string value
 * @param val   double result
 * @return      number of bytes used in string