//============================================================================== // bmptest1.cpp // Tests the DrtBmpFile::open() and close() functions. // // Acknowledgements // Derived from source code written by David R. Tribble, Jan 1992. // // Copyright ©2008 by David R. Tribble, all rights reserved. // Permission is granted to any person or entity except those designated // by the United States Department of State as a terrorist, or terrorist // government or agency, to use and distribute this source code provided // that the original copyright notice remains present and unaltered. //============================================================================== // Identification static char REV[] = "@(#)drt/bmp/bmptest1.cpp $Revision: 1.2 $$Date: 2008/06/28 16:26:21 $"; // System includes #include #define sys_errno_h 1 #include #define sys_iso646_h 1 #include #define sys_stddef_h 1 #include #define sys_stdint_h 1 #include #define sys_stdio_h 1 #include #define sys_string_h 1 // Local includes #include "bmpdefs.h" #include "bmpfile.hpp" //------------------------------------------------------------------------------ // ::main() // Test driver. // // @since // 1.1, 2008-04-27 //------------------------------------------------------------------------------ int main(int argc, const char **argv) { #if DrtBmpFile_VS/100 != 1 #error class DrtBmpFile has changed #endif const char * fname; DrtBmpFile * bmp; // Check args if (argc < 2) { usage: printf("Open a BMP graphic image file.\n\n"); printf("usage: %s file.bmp\n", argv[0]); return 255; } // Open the BMP file fname = argv[1]; printf("Open \"%s\"...\n", fname); bmp = DrtBmpFile::open(fname, DrtBmpFile::M_READ); if (bmp == NULL) { printf("Failed, error %d: %s\n", sys_errno, ::strerror(sys_errno)); return 1; } // Close the BMP file printf("Closing...\n"); bmp->close(); return 0; } // End bmptest1.cpp