diff options
author | Brad Pitcher <bradpitcher@gmail.com> | 2011-11-01 17:15:35 (GMT) |
---|---|---|
committer | Brad Pitcher <bradpitcher@gmail.com> | 2011-11-01 17:15:35 (GMT) |
commit | e2caf3726d68ff1fef63113519049abffc0563af (patch) | |
tree | 6558c6f03ccc21e7138d23861f80e8d97b09e60e /tests/dumptest.cc | |
parent | 7541854212d6c1223e015faf55a6ca0657a1c184 (diff) | |
parent | cb56f700b1b0f4ae589da62a5fd1d4e368deb604 (diff) |
merge master
Diffstat (limited to 'tests/dumptest.cc')
-rw-r--r-- | tests/dumptest.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/dumptest.cc b/tests/dumptest.cc index 65424b3..3782446 100644 --- a/tests/dumptest.cc +++ b/tests/dumptest.cc @@ -39,10 +39,13 @@ #include <QFile> #include <QDir> #include <QSet> +#ifndef _MSC_VER #include <getopt.h> +#endif #include <assert.h> #include <iostream> #include <sstream> +#include <fstream> using std::string; @@ -53,12 +56,13 @@ QString librarydir; int main(int argc, char **argv) { - if (argc != 2) { - fprintf(stderr, "Usage: %s <file.scad>\n", argv[0]); + if (argc != 3) { + fprintf(stderr, "Usage: %s <file.scad> <output.txt>\n", argv[0]); exit(1); } const char *filename = argv[1]; + const char *outfilename = argv[2]; int rc = 0; @@ -146,7 +150,10 @@ int main(int argc, char **argv) string dumpstdstr_cached = tree.getString(*root_node); assert(dumpstdstr == dumpstdstr_cached); - std::cout << dumpstdstr << "\n"; + std::ofstream outfile; + outfile.open(outfilename); + outfile << dumpstdstr << "\n"; + outfile.close(); destroy_builtin_functions(); destroy_builtin_modules(); |