im new in c++ and i am creating a version of cat for practicing what i have learned so far. What im doing for managing the command line arguments is converting them to library strings and then using them, but now i have the doubt if it is the correct / most optimal way to do it

  • leviosa
    link
    English
    4
    edit-2
    1 year ago

    You can quickly get the args into a vector like this:

    auto args = std::vector<std::string_view>(argv, argv + argc);
    

    Checking equality etc directly instead of using strcmp stuff is better. There are libraries available for handling command line args too.