Jan 06, 2018 Command Line argument in C programming using Dev C. 70+ channels, more of your favorite shows, & unlimited DVR storage space all in one great price.
Format C Command Prompt
i've never knew how to use command line arguments since the first source code i used to edit(and from i learned basics of c++) was using a config file to 'read' user input data on program startup and not command line arguments.
now my question, what's the difference between using command line arguments and creating a special designed class to read a config file (config.cfg) looking like this:
i know that on the first thought, the cfg option is far more complicated and timeconsuming, but almost every program needs a config file to read the default values for the data it needs
i ask this cuz i'm not sure if it's worth learning to use command line arguments or not
- 6 Contributors
- forum 12 Replies
- 812 Views
- 1 Month Discussion Span
- commentLatest Postby dospyLatest Post
Narue5,707
i ask this cuz i'm not sure if it's worth learning to use command line arguments or not
How To Run Dev C Command Prompt Argc Argv In C
Command line arguments are very simple and worth knowing. For example:
The arguments correspond exactly to what's typed into the console, which means there's a caveat that args[0] will be the program name in some form[*]. That's really all there is to it. You can quibble about the nuances of the argc and argv parameters, but there's little point in doing so, in my opinion. ;)
C Command Prompt Commands
[*] 'Some form' means it could be an empty string if the program name isn't available, or it could be a full path, or a relative path, or even just the executable name (to list some common results).