|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Examples, usage, help in C++ program
I have written a C++ program to perform raytracing and would want to write some functions to help the user: examples, usage, help
I am wondering how this is done. Would I just put some functions in the main program? |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
How to do it depends on what you already have and what exactly you want to do.
You're vague on both, so it's difficult to help. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Here's an example of how you'd do it in C: Code:
int main(int argc, char *argv[])
{
int n;
for(n=1; n<argc; n++)
{
if(strcmp(argv[n], "--help") == 0)
{
print_help();
exit(0);
}
}
} |
|
#4
|
|||
|
|||
|
That's what I've done. My question is where to put the function print_help();
I do have a few functions and they are quite long. They involve sending information to the user. I have now put them in another file. |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Wherever you like. You can put them in the same file, or not. Just make sure to have headers for them if you put them in a different file.
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Awk and Sed examples | j_panky | Emergency UNIX and Linux Support !! Help Me!! | 7 | 05-14-2010 12:16 AM |
| How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..? | laknar | AIX | 3 | 07-16-2009 05:35 AM |
| Checking mem usage at specific times in a program | pl4u | UNIX for Advanced & Expert Users | 2 | 04-05-2009 05:26 PM |
| how can I find cpu usage memory usage swap usage and logical volume usage | alert0919 | HP-UX | 3 | 12-02-2008 01:38 PM |
| usage of ftp in C program | bdyjm | Programming | 1 | 10-08-2001 11:05 AM |
|
|