getopt 
Author Message
 getopt

Hi,

I would like to use a module both as a subroutine and a main
program.  Therefore, the main() routine simply calls another
function that really does all the work.  The problem is with
parsing the parameters when calling that other function
directly.  How can I tell getopt to reparse the arguments?

Thanks and sorry for the ignorance.
--
                                          myriam



Mon, 13 Nov 2000 03:00:00 GMT  
 getopt

:
:Hi,
:
:I would like to use a module both as a subroutine and a main
:program.  Therefore, the main() routine simply calls another
:function that really does all the work.  The problem is with
:parsing the parameters when calling that other function
:directly.  How can I tell getopt to reparse the arguments?
===========
getopt is not a standard function in C.  The way it works
depends completely on your implementation.  Suppose
that getopt is protootyped as
    int getopt(int argc, char * const *argv,  const char *oprions);
and you have a function
    f(int argc, char *argv[]);
Use getopt in f exactly as you would in main.
    int main(int argc, char *argv[])
    {
        f(argc, argv);
        return 0;
    }
What's the problem?
============

:
:Thanks and sorry for the ignorance.
:--
:                                          myriam
:
:



Mon, 13 Nov 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Anyone have source of C getopt or a better getopt

2. New release of nearly-strictly-conforming getopt clone (0.4)

3. const in respect to argv, why I hate getopt's argv parameter

4. stretching getopt

5. Help with getopt

6. getopt() problems

7. unistd.h [getopt()]

8. better getopt

9. Help: getopt() stopping call to accept()

10. getopt multichar arg

11. getopt: passing a multi-word string as a single arg

12. getopt() with non one character options

 

 
Powered by phpBB® Forum Software