Menu
Menu
DaniWeb
Log In
Sign Up
Read
Contribute
Meet
Search
Search
About 345 results for
getopt
- Page 1
Re: getopt - help
Programming
Software Development
15 Years Ago
by ArkM
As far as I know you need "t:"
getopt
option. May be I'm wrong (I don't like
getopt
;)). See [url]http://www.gnu.org/software/libtool/manual/libc/Using-
Getopt
.html#Using-
Getopt
[/url]
getopt - help
Programming
Software Development
15 Years Ago
by TooMpa
… The problem is I don't know how to get
getopt
to read -t and then take next char as an…; extern char *optarg; extern int optind, optopt, opterr; while ((c =
getopt
(argc, argv, "t")) != -1){ switch(c){ case 't…
Re: getopt - help
Programming
Software Development
15 Years Ago
by ArkM
Nothing serious. I don't like a rigid and unclear (in my opinion)
getopt
loop (and option string too ;)). It's a matter of personal preferences only. Probably the
getopt
is the best solution in C, but in C++ it looks like a steam-engine in Tokkaido Line train... But it's the other story...
Re: getopt - help
Programming
Software Development
15 Years Ago
by stilllearning
Yeah it should be "t:" and if t is an optional argument it should be "t::" why don't you like
getopt
?
getopt?
Programming
Software Development
15 Years Ago
by toolbox03
how do I extract the arguments using
getopt
Usage: test.py -P abc -S def -G xyz How do I extract the values abc, def and xyz?
Re: getopt?
Programming
Software Development
15 Years Ago
by jlm699
I don't know about
getopt
but all of those things are stored in the list stored under sys.argv [code=python] >>> import sys >>> sys.argv[0] >>> len(sys.argv)[/code] Try those lines and then you should be able to handle the command line arguments yourself.
getopt python parser
Programming
Software Development
12 Years Ago
by halamas
… a word and replace it with another one using the
getopt
parser. The thing that I'm having troubles with is…<file name> " import sys import
getopt
count=False opts,extraparams=
getopt
.
getopt
(sys.argv[1:],"hi:cmwr:e:n…
Re: GetOpt::Long
Programming
Software Development
14 Years Ago
by Murtan
I found this code example [code=Perl] use
Getopt
::Long; my $data = "file.dat"; my $length = 24… => \$verbose); # flag [/code] at [url]http://perldoc.perl.org/
Getopt
/Long.html[/url] (The first page returned for google "…;perl
getopt
long") If you've read through that page and…
GetOpt::Long
Programming
Software Development
14 Years Ago
by Manny7
… of code, which testing arguments on command line: [CODE] use
Getopt
::Long; GetOptions( "verbose" => \$verbose, "get"… the code to adjust.. :/ (I have to use the module
GetOpt
::Long) Thank you for your tips.
Re: GetOpt::Long
Programming
Software Development
14 Years Ago
by d5e5
… #OneDashOrTwo.pl use 5.006; use strict; use warnings; use
Getopt
::Long qw(:config bundling); my ($verbose, $get, $v, $g); GetOptions…
Re: getopt - help
Programming
Software Development
15 Years Ago
by ssharish2005
[QUOTE]filetype = ????; [/QUOTE] So if the flag matches, you can get the argument by the global variable optarg. That should hold pointer to the argument which you are looking for! [code="c"] filetype = optarg; [/code] ssharish
Re: getopt?
Programming
Software Development
15 Years Ago
by iamthwee
If you have access to test.py (the source code I mean) you could modify it to pipe the values to a text file perhaps.
Re: How to use GetOpt
Programming
Software Development
9 Years Ago
by sfuo
…I am not 100% sure but after reading [on
GetOpt
here](http://www.gnu.org/software/libc/manual/html_node/…Using-
Getopt
.html#Using-
Getopt
) and [a
GetOpt
example here](http://www.gnu.org/software/…libc/manual/html_node/Example-of-
Getopt
.html#Example-of-
Getopt
) I would say the short answer is you…
Help with getopt/getopts
Programming
Software Development
17 Years Ago
by swmercenary
… script which runs on AIX and LINUX. It currently uses
getopt
to parse command line options, and relies on syntax like… an argument and the argument is missing,
getopt
hangs (the usage statement following the
getopt
line is never reached). This would be…
Re: How to use GetOpt
Programming
Software Development
9 Years Ago
by rubberman
… the examples: /* The following trivial example program uses
getopt
() to handle two program options: -n, with no…tfnd; nsecs = 0; tfnd = 0; flags = 0; while ((opt =
getopt
(argc, argv, "nt:")) != -1) { switch (opt) { case…
Word comparison - Vectors /Getopt
Programming
Software Development
11 Years Ago
by anonymous1987
Please Help!!! My understanding of
getopt
is very limited. I do however realise that argv[0] …> list; vector <string>::iterator i; while ((c =
getopt
(argc, argv, ":wpsaejivn:")) != -1) { switch (c) { case 'w…
How to use GetOpt
Programming
Software Development
9 Years Ago
by choconom
Hi, I need to use
getopt
for a program called like myprogram.c file1 file2 file3 -… must be provided). It would help if someone could explain
getopt
in simple terms as well, I feel like my brain…
Re: Doubt regarding Getopt
Programming
Software Development
13 Years Ago
by mitchems
I like to use a different
GetOpt
[CODE] use
Getopt
::Std; getopts("f:d:r"); my $file=$opt_f; my $dir=$opt_d; my $ren_flag=1 if($opt_r); [/CODE] Would that work for you?
Doubt regarding Getopt
Programming
Software Development
13 Years Ago
by anraevlus18
… from local machine to a remote machine. I am using
Getopt
::Long to get the command line arguments. "-d"…
Re: Doubt regarding Getopt
Programming
Software Development
13 Years Ago
by d5e5
…]#!/usr/bin/perl #getopt01.pl use strict; use warnings; use
Getopt
::Long; my ($help, @dir, @rename_to); #-- prints usage if there is…
Re: Doubt regarding Getopt
Programming
Software Development
13 Years Ago
by d5e5
…]#!/usr/bin/perl #getopt01.pl use strict; use warnings; use
Getopt
::Long; my (@dir, @fil); #-- prints usage if there is an…
Re: Doubt regarding Getopt
Programming
Software Development
13 Years Ago
by anraevlus18
I think the problem was with the version itself. I downloaded the new version of
Getopt
::Long and now its working fine. Thanks for your support, all.
Re: Doubt regarding Getopt
Programming
Software Development
13 Years Ago
by d5e5
That's great. I didn't think of that (
Getopt
:Long version.) Please mark this thread solved (even though it was you that solved it. :))
Using getopt()
Programming
Software Development
12 Years Ago
by ckwolfe
…, char **argv){ int index, b, s; int c; while ((c =
getopt
(argc, argv, "b:s:")) > 0) { switch (c…
Re: Using getopt()
Programming
Software Development
12 Years Ago
by andrewll2
…, char **argv){ int index, b, s; int c; while ((c =
getopt
(argc, argv, "b:s:")) > 0) { switch (c…
Re: Using getopt()
Programming
Software Development
12 Years Ago
by ckwolfe
…, char **argv){ int index, b, s; int c; while ((c =
getopt
(argc, argv, "b:s:")) > 0) { switch (c…
Re: GetOpt::Long
Programming
Software Development
14 Years Ago
by Manny7
Uhh.. well how i can distinguish, if the user entered '-verbose' or '--verbose'??? This is the thing, what i don't know... :/
Re: GetOpt::Long
Programming
Software Development
14 Years Ago
by Murtan
Not to be rude about it, but why do you care if the user entered '-verbose' or '--verbose'? If they both make the output verbose, why should they care?
Re: Help with getopt/getopts
Programming
Software Development
17 Years Ago
by jim mcnamara
I don't have a quick good answer, getopts only returns the first string of multiple arguments into OPTARG for a given option Here is a good discussion of argument handling: [url]http://www.shelldorado.com/goodcoding/cmdargs.html[/url]
Re: Word comparison - Vectors /Getopt
Programming
Software Development
11 Years Ago
by mike_2000_17
Well, this line doesn't make any sense: list == argv[3]; Neither does this one: cout << *list << endl; Maybe you should explain what you think these lines are supposed to do, because it doesn't seem obvious to me (nor for the compiler). The variable `list` is a vector of strings, it doesn't make any sense to compare it …
1
2
3
6
Next
Last
Search
Search
Forum Categories
Hardware/Software
Programming
Digital Media
Community Center
Latest Content
Newest Topics
Latest Topics
Latest Posts
Latest Comments
Top Tags
Topics Feed
Social
Meet People
Forums
Top Members
Community Functions
DaniWeb Premium
Newsletter Archive
Markdown Syntax
Community Rules
Developer APIs
Connect API
Forum API Docs
Tools
SEO Backlink Checker
Legal
Terms of Service
Privacy Policy
FAQ
About Us
Advertise
Contact Us
© 2024 DaniWeb® LLC