Tranform string values into double-precision numbers

This commit is contained in:
Nick Chambers 2022-06-20 13:20:00 -05:00
parent 826abb2ae3
commit a1f9b3a9b8
1 changed files with 8 additions and 0 deletions

View File

@ -21,6 +21,14 @@ uint8_t gargoyle_from_rope(struct gargoyle_opt *opt, const char *brand) {
if(*end) {
return GARGOYLE_ERR_INVALID_UINT;
}
} else if(opt->type & GARGOYLE_TYPE_DBLE) {
char *end = NULL;
double *val = opt->val;
*val = strtod(brand, &end);
if(*end) {
return GARGOYLE_ERR_INVALID_DBLE;
}
}
return 0;