// file: $isip/doc/examples/class/shell/shell_example_01/example.cc // version: $Id: example.cc 6108 2000-12-28 21:31:57Z duncan $ // // this is a simple utility that displays information about sof // files. it demonstrates the basic usage of Sdb and CommandLine. // // isip include files // #include #include #include // main program starts here // int main(int argc, const char **argv) { // parse the command line and connect it to an Sdb object. this // tells Sdb that all arguments on the command line are files for // Sdb to iterate through. // Sdb sdb1; CommandLine cmdl(sdb1); cmdl.parse(argc, argv); // loop over all files in the Sdb object. the call to gotoFirst will // return true if there is at least one file to "go" to, false if it // is an empty list. the gotoNext call will return true if the // current position is not the last file in the list. // for (boolean file = sdb1.gotoFirst(); file; file = sdb1.gotoNext()) { Sof sof1; Filename filename; // open file in read-only mode // sdb1.getName(filename); if (!sof1.open(filename, File::READ_ONLY)) { return Error::handle(sof1.name(), L"open", Error::TEST, __FILE__, __LINE__); } // output information about the file to the Console // sof1.debug(L"This is the sof file "); Console::put(L"\n"); // close the file // sof1.close(); } // exit gracefully // Integral::exit(); }