# Detect the Format of a File

You can detect the format of a file by using the `detect` method. For example:

    auto myinput = keyview::io::InputFile{ std::string("InputFile.docx") };
    auto detection_info = KV.detect(myinput);

    // Print out what we found
    std::cout << "Format:\t" << static_cast<int>(detection_info.format()) << "\n";
    std::cout << "Description:\t" << detection_info.description() << "\n";
    std::cout << "Version:\t" << detection_info.version() << "\n";
    std::cout << "Category:\t" << static_cast<int>(detection_info.category()) << "\n";
    std::cout << "Category Name:\t" << detection_info.category_name() << "\n";
    std::cout << "Encrypted:\t" << std::boolalpha << detection_info.encrypted() << "\n";

© Copyright 2016-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm