I’m working on a C++ program that accepts a filename as a command line input, reads a bunch of data from that file, computes two things about the data, then exits. One of those computations must be done, but the other is much more optional, so I thought it would be neat to add a -c flag to turn it off. Naively, I would just always assume that if the user gives two arguments, the first must toggle the computation and the second gives the filename, but this gets much more cumbersome with more flags. What is the standard practice for making rm -rf "file", rm -fr "file", and rm "file" -rf all work as valid commands?
I’m working on a C++ program that accepts a filename as a command line
Share
Use boost program options . Example: