"Fossies" - the Fresh Open Source Software Archive

Member "cppcheck-1.89/oss-fuzz/translate.cpp" (1 Sep 2019, 612 Bytes) of package /windows/misc/cppcheck-1.89.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "translate.cpp" see the Fossies "Dox" file reference documentation.

    1 
    2 #include <fstream>
    3 #include <iostream>
    4 
    5 #include "type2.h"
    6 
    7 int main(int argc, char **argv)
    8 {
    9     const char *filename = argc==2 ? argv[1] : nullptr;
   10 
   11     if (!filename) {
   12         std::cout << "Invalid args, no filename\n";
   13         return 1;
   14     }
   15 
   16     std::ifstream f(filename);
   17     if (!f.is_open()) {
   18         std::cout << "failed to open file:" << filename << "\n";
   19         return 1;
   20     }
   21 
   22     std::string str((std::istreambuf_iterator<char>(f)),
   23                     std::istreambuf_iterator<char>());
   24 
   25     std::cout << generateCode2((const uint8_t *)str.data(), str.size()) << std::endl;
   26 
   27     return 0;
   28 }
   29