Changeset 6216


Ignore:
Timestamp:
Mar 29, 2016 8:52:47 AM (8 years ago)
Author:
ldelgass
Message:

add args for collection, filename to idatatest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • geovis/trunk/idatatest.cpp

    r5895 r6216  
    22#include <cstdlib>
    33#include <iostream>
     4#include <sstream>
    45#include <fstream>
    56
     
    2223    }
    2324
     25    int collection = 3;
     26    if (argc > 1) {
     27        collection = atoi(argv[1]);
     28    }
     29
    2430    std::cout << std::endl << std::endl;
    2531    std::vector<DirectoryItem> dir;
    26     getContents(3, "", dir);
     32    getContents(collection, "", dir);
    2733    std::cout << std::endl << std::endl;
    2834    for (std::vector<DirectoryItem>::iterator itr = dir.begin();
     
    3743
    3844    std::cout << std::endl << std::endl;
     45    const char *filename = NULL;
     46    if (argc > 2) {
     47        filename = argv[2];
     48    } else if (collection == 3) {
     49        filename = "station.csv";
     50    } else {
     51        iDataCleanup();
     52        return 0;
     53    }
     54
     55    std::ostringstream oss;
     56    oss << "//" << filename;
    3957    Buffer buff;
    40     getFile(3, "//station.csv", &buff);
     58    getFile(collection, oss.str().c_str(), &buff);
    4159    std::cout << std::endl << std::endl;
    42     std::cout << "station.csv size: " << buff.size << std::endl;
    43     std::ofstream file("station.csv");
     60    std::cout << filename << " size: " << buff.size << std::endl;
     61    std::ofstream file(filename);
    4462    file.write((char *)buff.data, buff.size);
    4563    file.close();
Note: See TracChangeset for help on using the changeset viewer.