ISO9660 is an ISO 9660 (ECMA-119) filesystem reader and writer library and command-line utility with support for Rock Ridge, Joliet, and El Torito. It is intended for software developers and system administrators working with optical disc images on POSIX systems.
- C23 standard library
- POSIX.1-2008 system APIs
- CMake 3.20 or newer (build dependency)
- C23-compatible C compiler such as GCC 13+ or Clang 16+ (build dependency)
Optional test dependencies:
- cdrtools (
isoinfo) - genisoimage
- 7-Zip (
7z)
Configure and compile the static library, shared library, command-line tool, and test suite:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build buildRun test suite:
ctest --test-dir build --output-on-failureTo build with AddressSanitizer and UndefinedBehaviorSanitizer:
cmake -B build-asan -DCMAKE_C_FLAGS="-fsanitize=address,undefined -g -fno-omit-frame-pointer"
cmake --build build-asan
ctest --test-dir build-asan --output-on-failureCreate an image:
./build/iso9660 create -o image.iso -V "DATA" -J -R /path/to/sourceCreate a bootable image:
./build/iso9660 create -o boot.iso -V "BOOT" -J -R -b boot.img /path/to/sourceDisplay image metadata:
./build/iso9660 info image.isoList contents:
./build/iso9660 list image.isoExtract a single file:
./build/iso9660 extract image.iso /docs/manual.txt ./manual.txtExtract the entire filesystem:
./build/iso9660 extract-all image.iso ./output_dirWriting an image:
#include <iso9660/iso9660.h>
int main(void) {
iso9660_writer_opts_t opts;
iso9660_writer_opts_default(&opts);
opts.enable_joliet = true;
opts.enable_rockridge = true;
iso9660_writer_t *writer = NULL;
iso9660_writer_create(&opts, &writer);
iso9660_writer_add_tree(writer, "/path/to/source", "/");
iso9660_writer_write_file(writer, "output.iso");
iso9660_writer_destroy(writer);
return 0;
}Reading an image:
#include <iso9660/iso9660.h>
#include <stdio.h>
int main(void) {
iso9660_reader_t *reader = NULL;
if (iso9660_reader_open_file("output.iso", &reader) != ISO9660_OK) {
return 1;
}
iso9660_stat_t st;
if (iso9660_reader_stat(reader, "/file.txt", &st) == ISO9660_OK) {
printf("Size: %lu bytes\n", (unsigned long)st.size);
}
iso9660_dir_t *dir = NULL;
if (iso9660_reader_opendir(reader, "/", &dir) == ISO9660_OK) {
iso9660_stat_t entry;
while (iso9660_reader_readdir(dir, &entry) == ISO9660_OK) {
printf("%s\n", entry.name);
}
iso9660_reader_closedir(dir);
}
iso9660_reader_close(reader);
return 0;
}- ECMA-119 specification (ISO 9660:1988)
- IEEE P1282 System Use Sharing Protocol (SUSP) and Rock Ridge Interchange Protocol (RRIP)
- Microsoft Joliet specification
- Phoenix Technologies and IBM "El Torito" Bootable CD-ROM Format Specification version 1.0
- CONTRIBUTING.md
- Public header API documentation: include/iso9660/
This project is licensed under the GNU General Public License v3.0 or later. See LICENSE.