How do you accept arguments in the main.cpp file and reference another file?
Posted
by
Jason H.
on Programmers
See other posts from Programmers
or by Jason H.
Published on 2012-07-11T03:08:27Z
Indexed on
2012/09/15
3:47 UTC
Read the original article
Hit count: 271
I have a basic understanding of programming and I currently learning C++. I'm in the beginning phases of building my own CLI program for ubuntu. However, I have hit a few snags and I was wondering if I could get some clarification. The program I am working on is called "sat" and will be available via command line only. I have the main.cpp.
However, my real question is more of a "best practices" for programming/organization. When my program "sat" is invoked I want it to take additional arguments.
Here is an example:
> sat task subtask
I'm not sure if the task should be in its own task.cpp file for better organization or if it should be a function in the main.cpp? If the task should be in its own file how do you accept arguments in the main.cpp file and reference the other file?
Any thoughts on which method is preferred and reference material to backup the reasoning?
© Programmers or respective owner