How to parse command line arguments

Hi there,

I was hoping someone could enlighten me on how to parse command line arguments using a JUCE class such as the Argument List struct or the application command manager. I have been experimenting with these classes but can’t seem to figure out where to start other than there is a string in my main applications Initialise function that gives me all my command line arguments as a single string.

Does anyone know the most efficient way to parse command line arguments?

Thanks in advance,

Ed

Please try to use getCommandLineParameterArray() which is a static method of JUCEApplicationBase

Edit: I mean this way you can get command line parameters everywhere in you program (not only in initialise) and then you can parse them as you want using external classes or invoking some actions directly.

3 Likes

I recently used the TCLAP library, it’s something you need to add the path to in Projucer, once you’ve done that it’s fairly straightforward to use.

Thank you very much for your help. This is exactly what I was looking for!

1 Like

Cheers. This looks interesting although I think I will stick with the JUCE classes for now to avoid extra dependencies.