ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
getopt.cpp
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Author: David Fournier
5  * Copyright (c) 2008-2012 Regents of the University of California
6  */
11 #include <admodel.h>
12 
17 int get_option_number(const char * option_name,const char * error_message,
18  int& option_value)
19 {
20  int on1;
21  int nopt;
22  if ( (on1=option_match(ad_comm::argc,ad_comm::argv,option_name,nopt))>-1)
23  {
24  if (!nopt)
25  {
26  if (ad_printf)
27  (*ad_printf)("%s\n",error_message);
28  else
29  cerr << error_message << endl;
30  on1=-1;
31  }
32  else
33  {
34  option_value=atoi(ad_comm::argv[on1+1]);
35  }
36  }
37  return on1;
38 }
static char ** argv
Definition: fvar.hpp:8866
int get_option_number(const char *option_name, const char *error_message, int &option_value)
Description not yet available.
Definition: getopt.cpp:17
int atoi(adstring &s)
Returns a integer converted from input s.
Definition: atoi.cpp:20
prnstream & endl(prnstream &)
static int argc
Definition: fvar.hpp:8863
Description not yet available.
int option_match(int argc, char *argv[], const char *string)
Checks if the program has been invoked with a particular command line argument (&quot;string&quot;).
Definition: optmatch.cpp:25
int ad_printf(FILE *stream, const char *format, Args...args)
Definition: fvar.hpp:9487