diff options
author | rodri <rgl@antares-labs.eu> | 2020-02-22 09:56:09 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2020-02-22 09:56:09 +0000 |
commit | a39951d8f69209cfea2b7051832b851914e662ef (patch) | |
tree | e4cd1c32e5d6f531b523f6fda558cc3a5f603547 /doubleparse.c | |
download | brokentoys-a39951d8f69209cfea2b7051832b851914e662ef.tar.gz brokentoys-a39951d8f69209cfea2b7051832b851914e662ef.tar.bz2 brokentoys-a39951d8f69209cfea2b7051832b851914e662ef.zip |
now version controlled.
Diffstat (limited to 'doubleparse.c')
-rw-r--r-- | doubleparse.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/doubleparse.c b/doubleparse.c new file mode 100644 index 0000000..497b904 --- /dev/null +++ b/doubleparse.c @@ -0,0 +1,20 @@ +#include <u.h> +#include <libc.h> +#include <ctype.h> + +void +main() +{ + char *s, buf[512]; + double n[2]; + + read(0, buf, sizeof(buf)-1); + buf[sizeof(buf)-1] = 0; + s = buf; + n[0] = strtod(s, &s); + while(isspace(*++s)) + ; + n[1] = strtod(s, &s); + print("n0: %g\nn1: %g\n", n[0], n[1]); + exits(0); +} |