I have been assigned the command: tree -a -F -L level-q -T title. I have to capture the flags and the code is already given to me. All I have to do is find the datatypes for these flags and set up the code such as :

struct FLAG {

      bool   uflag;
      bool   vflag;
      char   *wflag;
      int    xflag;
      double yflag;
      bool   zflag;

  } flags={false,false,"none",0,100,false}; //Set up defaut values

So how can I find out the datatypes of the flags through the man pages?

  • 1
    Well, the manual will tell you what each flag does - whether it's a toggle option, or whether it accepts an input of a specific type. Isn't that information sufficient to determine the data type required? – Haxiel Jan 23 '19 at 6:32
  • The type would all be strings in the shell. As with any user input, you would have to read string data and then verify that they have correct datatype by converting e.g. strings that should be integers with strtol() and checking for conversion errors. – Kusalananda Jan 23 '19 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.