1
// ***************************************************************** -*- C++ -*-
2
// crwparse.cpp, $Rev: 1271 $
3
// Print the CIFF structure of a CRW file
5
#include <exiv2/crwimage.hpp>
6
#include <exiv2/futils.hpp>
10
int main(int argc, char* const argv[])
13
std::cout << "Usage: " << argv[0] << " file\n";
14
std::cout << "Print the CIFF structure of a CRW file\n";
18
Exiv2::FileIo io(argv[1]);
20
throw Exiv2::Error(9, io.path(), Exiv2::strError());
22
Exiv2::IoCloser closer(io);
24
// Ensure that this is a CRW image
25
if (!Exiv2::isCrwType(io, false)) {
26
if (io.error() || io.eof()) throw Exiv2::Error(14);
27
throw Exiv2::Error(33);
30
// Read the image into a memory buffer
32
Exiv2::DataBuf buf(len);
33
io.read(buf.pData_, len);
34
if (io.error() || io.eof()) throw Exiv2::Error(14);
36
// Parse the image, starting with a CIFF header component
37
Exiv2::CiffHeader::AutoPtr parseTree(new Exiv2::CiffHeader);
38
parseTree->read(buf.pData_, buf.size_);
39
parseTree->print(std::cout);
43
catch (Exiv2::AnyError& e) {
44
std::cerr << e << "\n";