CBR libraries for C/C++
Two libraries read RAR in C and C++; neither writes it (no open-source code can):
- UnRAR is RARLAB’s reference decoder. It supports every RAR feature, including RAR5, encryption and multi-volume archives. Its license is freeware, not OSI open source: free to use and ship, but not for building a RAR compressor.
- libarchive has its own BSD-licensed RAR decoder for RAR 2.9-4 and RAR5, and reads ZIP, 7z and TAR with the same API. It doesn’t decrypt password-protected RAR. It’s the simpler choice when you also open CBZ, CB7 and CBT.
Some programs ship both: SumatraPDF, for example, opens RAR with UnRAR and other archives with libarchive. Parse ComicInfo.xml with any XML library; the examples use pugixml.
- libarchive Read CBR comic book archives (RAR4 and RAR5) in C/C++ with libarchive: list pages in natural order, extract the cover, read ComicInfo.xml.
- UnRAR Read CBR comic book archives in C/C++ with RARLAB's UnRAR library (unrar.dll, libunrar): list pages in natural order, read pages into memory.