home *** CD-ROM | disk | FTP | other *** search
- //: C09:ErrTest.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- // Testing require.h
- #include "../require.h"
- #include <fstream>
- using namespace std;
-
- int main(int argc, char* argv[]) {
- int i = 1;
- require(i, "value must be nonzero");
- requireArgs(argc, 1);
- requireMinArgs(argc, 1);
- ifstream in(argv[1]);
- assure(in, argv[1]); // Use the file name
- ifstream nofile("nofile.xxx");
- assure(nofile); // The default argument
- ofstream out("tmp.txt");
- assure(out);
- } ///:~
-