Tranform string values into double-precision numbers
This commit is contained in:
parent
826abb2ae3
commit
a1f9b3a9b8
1 changed files with 8 additions and 0 deletions
|
@ -21,6 +21,14 @@ uint8_t gargoyle_from_rope(struct gargoyle_opt *opt, const char *brand) {
|
||||||
if(*end) {
|
if(*end) {
|
||||||
return GARGOYLE_ERR_INVALID_UINT;
|
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;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue