aboutsummaryrefslogtreecommitdiff
path: root/tests/cube2md5.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-05-26 19:45:05 +0200
committerAlon Zakai <alonzakai@gmail.com>2012-05-26 19:45:05 +0200
commite38d9980c45deeeb1bc50240fd5def8a88da2932 (patch)
tree65bc96935b25303b00a4008fa016bd84fe594fc2 /tests/cube2md5.cpp
parentdfe17491276ec8b660e31b45f6c628bc028fe93a (diff)
fix strtod behavior on non-ints
Diffstat (limited to 'tests/cube2md5.cpp')
-rw-r--r--tests/cube2md5.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/cube2md5.cpp b/tests/cube2md5.cpp
new file mode 100644
index 00000000..d2a638d1
--- /dev/null
+++ b/tests/cube2md5.cpp
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+FILE *file;
+bool getline(char *str, int len) { return fgets(str, len, file)!=NULL; }
+
+int main() {
+ file = fopen("cube2md5.txt", "r");
+ char buf[1024];
+ int tmp;
+ getline(buf, sizeof(buf));
+ if(sscanf(buf, " frame %d", &tmp)==1)
+ {
+ printf("frame %d\n", tmp);
+ for(int numdata = 0; getline(buf, sizeof(buf)) && buf[0]!='}';)
+ {
+ printf("frameline\n");
+ for(char *src = buf, *next = src; numdata < 198; numdata++, src = next)
+ {
+ double x = strtod(src, &next);
+ printf("animdata[%d] = %.8f\n", numdata, x);
+ if(next <= src) break;
+ }
+ }
+ }
+ return 1;
+}
+