2

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

you are viewing a single comment's thread
view the rest of the comments
[-] leviosa@programming.dev 4 points 1 year ago* (last edited 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.

this post was submitted on 25 Jul 2023
2 points (100.0% liked)

C++

1708 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 1 year ago
MODERATORS