argv Questions

3

Solved

I'm pretty new at python and I've been playing with argv. I wrote this simple program here and getting an error that says : TypeError: %d format: a number is required, not str from sys import ...
Yeast asked 29/6, 2013 at 18:32

6

Solved

I am confused as to how the following passage matches up with the code that follows it: Since argv is a pointer to an array of pointers, we can manipulate the pointer rather than index the arra...
Clearsighted asked 22/6, 2013 at 20:10

1

Solved

I wrote a perl program to take a regex from the command line and do a recursive search of the current directory for certain filenames and filetypes, grep each one for the regex, and output the resu...
Shay asked 22/5, 2013 at 16:54

2

Solved

I would like to parse a string like this: -o 1 --long "Some long string" into this: ["-o", "1", "--long", 'Some long string'] or similar. This is different than either getopt, or optparse, ...
Spickandspan asked 22/5, 2009 at 18:24

2

I read an article (forgot the URL), which said that argv[argc] is a NULL pointer (contains \0). To check whether if its true I wrote this code, yeah it exist. What I don't understand is, why ...
Fairground asked 7/5, 2013 at 12:21

5

For my program I have to make sure the user only inputs a positive INTEGER. for example if the user inputted 12hi it should not run the program and print to std error. I am not quite sure how to im...
Salvatore asked 22/4, 2013 at 21:17

1

I pass an executable on the command-line to my python script. I do some calculations and then I'd like to send the result of these calculations on STDIN to the executable. When it has finished I wo...
Uitlander asked 3/4, 2013 at 10:41

3

Solved

What is the standard practice in Python when I have a command-line application taking one argument which is URL to a web page or path to a HTML file somewhere on disk (only one) is sufficient ...
Southeastwards asked 21/10, 2011 at 13:8

1

Solved

My main function is as follows: int main(int argc, char const *argv[]) { huffenc(argv[1]); return 0; } The compiler returns the warning: huffenc.c:76: warning: passing argument 1 of ‘huffenc...
Standoffish asked 13/3, 2013 at 23:36

2

Solved

I notice that Node defines both process.argv and process.ARGV (capitalized). The later isn't mentioned in the documentation and is, in every case I've encountered so far, the same object. Is ARGV ...
Tengdin asked 28/4, 2011 at 22:14

4

Solved

Possible Duplicate: About command line arguments of main function How would I determine what the maximum size of data I could pass into a C main(int argc, char* argv)? Is there a macr...
Powerhouse asked 19/1, 2013 at 22:17

4

Solved

I am reading "Learn Python the Hard Way" and was confused by the "script" part of the second line. from sys import argv script, filename = argv From what I understand, the second line says: scri...
Shafting asked 2/12, 2012 at 4:15

3

Solved

As we know, array name can't be assigned, sentence like: char * array[], * point; array = point; /* wrong */ array++; /* wrong */ But in main(int argc, char * argv[]), argv++ is ok and works we...
Melitamelitopol asked 21/11, 2012 at 19:24

4

Solved

Possible Duplicate: argc and argv in main I'm having difficulty understanding the notation used for the general main function declaration, i.e. int main(int argc, char *argv[]). I und...
Stencil asked 13/11, 2012 at 15:9

2

Solved

I am having trouble with using execvp(). execvp() expects type char * const* as second parameter. I want to parse arguments passed to application (in argv) and make an array of that type. For examp...
Otherdirected asked 18/10, 2012 at 18:13

5

My demo.rb: puts ARGV.size ARGV.each do |a| puts "Argument: #{a}" end The result depends on how we run a script: > demo.rb foo bar 0 > ruby demo.rb foo bar 2 Argument: foo Argument: ba...
Tko asked 27/8, 2009 at 13:48

2

Solved

I'm wondering if command line parameters are always null terminated. Google seems to say yes, and compiling on GCC indicates this is the case, but can I guarantee this to always be true? int main(i...
Froggy asked 13/6, 2012 at 17:25

5

Solved

I want to retrieve the n-th parameter of $@ (the list of command line parameters passed to the script), where n is stored in a variable. I tried ${$n}. For example, I want to get the 2nd command ...
Weathering asked 25/5, 2012 at 7:5

1

Solved

The execv() function expects an array of NULL terminated strings but doesn't take the number of arguments. It uses a sentinel value (NULL pointer) to determine when the array ends. The man page fo...
Semantics asked 16/5, 2012 at 13:34

3

Solved

If you are running a frozen python script (frozen using py2exe) from a directory and drive different from where the script is present, what is the best way to determine the path of the executing sc...
Freeness asked 24/4, 2012 at 7:46

4

Solved

I'm learning about buffer overflows today and I came across many examples of programs which are vulnerable. The thing which makes me curious is, if there is any reason to work with program's argume...
Clausius asked 20/4, 2012 at 15:25

5

Solved

Assume I have char **argv. First, how can I print out all the strings in argv? I tried the following: char *temp; temp = *argv; // Now points to the first string? while (temp != NULL) { printf("...
Lippi asked 25/3, 2012 at 13:53

4

Solved

For some reason my C program is refusing to convert elements of argv into ints, and I can't figure out why. int main(int argc, char *argv[]) { fprintf(stdout, "%s\n", argv[1]); //Make conversi...
Dover asked 19/3, 2012 at 20:8

2

Solved

Is there a way to set argv[0] in a Haskell program (say, one compiled with ghc)? I found the getProgName and withProgName functions in System.Environment, but it doesn't seem to change what ps rep...
Staffordshire asked 29/2, 2012 at 16:46

4

Solved

I am learning from code, and I am get confused by one of its lines which is: things = [float(arg) for arg in sys.argv[1:]] Omega_a, Omega_b, Delta_a, Delta_b, \ init_pop_a, init_pop_b, tstep, tfin...
Blackthorn asked 26/2, 2012 at 17:6

© 2022 - 2024 — McMap. All rights reserved.