Questions tagged [args]

Common abbreviation for "arguments", often used in reference to command-line arguments or function arguments.

A program can accept any number of arguments from the command line. This allows the user to specify configuration information when the program is launched.

The user enters command-line arguments when invoking the application and specifies them after the name of the command to be run.

898 questions
-2
votes
1 answer

How can I transform a Java String from args[] to an integer

I've got a little problem with the java Timer: The main point is that it converts args[] to an int (which I can place in a timer-time) My code looks just like this: String bArgs = sArgument; int minutes = Integer.parseInt(args[1].toString()); Timer…
FreaX
  • 94
  • 1
  • 9
-2
votes
1 answer

C++ Passing args to void function

How can I pass args to this function: int myClass::myFunc(void * aArgs){ return 0; } I call it this way: thrd_create(&t, myClass::myFunc, (void*)0); I need to pass multiple arguments to the function, how can I achieve it?
ProtectedVoid
  • 1,293
  • 3
  • 17
  • 42
-2
votes
2 answers

Get file names separated c - linux

In C-linux - how can I get an input of unknown number of file names separated by space and save each file name separately as a string? and another question - a friend told me about "args" as a solution for some problems with unknown number of…
dvir naim
  • 13
  • 2
-2
votes
2 answers

main method String[] args issue

I'm reading Sams Teach Yourself Java in 24 Hours and came across this code: class NewRoot { public static void main(String[] args) { int number = 100; if (args.length > 0) { number = Integer.parseInt(args[0]); } …
HappyCane
  • 363
  • 1
  • 2
  • 10
-2
votes
2 answers

Methods/functions in Java

With the given code I was given the directions: Java lets us use Methods/Functions so we can store procedures that we may use more than once, so I would like you to update your code where there is common tasks it can be done inside a…
sluger233
  • 21
  • 7
-2
votes
2 answers

main(String[] args) different of String[] args = {.....}?

OK, here we go: When I pass arguments through the static main, my program works fine. but when I pass the same "arguments" declaring inside main, doesnt works. If sounds confused, here's the code. All I want is to do these thing works with no args…
Sycon
  • 1
  • 2
-2
votes
2 answers

Length of args in Java

What is the length of main's args in Java? is it dynamic? I want to pass parameters between two main methods, can I send any number of String arguments?
Curcuma_
  • 851
  • 2
  • 12
  • 37
-3
votes
1 answer

Convert keys and values

I have a problem with the dictionary I don't know how to convert keys to values I tried to find way to solve this problem on the internet but I didn't understand Expect: "I": 1 => 1:"I" convert = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100,…
Pham Hung
  • 53
  • 1
  • 6
-3
votes
1 answer

Extracting properties using SimpleCommandLinePropertySource does not work in Java

Trying to extract command line arguments using SimpleCommandLinePropertySource(arg) public static void main(String [] args) { SimpleCommandLinePropertySource argument = new SimpleCommandLinePropertySource(arg); } When i print argument, this is…
Parameswar
  • 1,951
  • 9
  • 34
  • 57
-3
votes
4 answers

python *args and lists

I have this assignment: Define a function that takes in an arbitrary number of arguments, and returns a list containing only those arguments that are even. Don't run the function simply provide the definition. What I've tried: def myfunc(*args): …
Meah
  • 1
  • 2
-3
votes
1 answer

What does argument args.length mean?

I would like to ask you about help explaining args.length !=2 in program below. In book I read they check whether there are two files but why using ! exclamation point? It doesn´t make sence for me. I have found info about args.length but not about…
Domorodec
  • 91
  • 12
-3
votes
2 answers

Scan a Java sentence and output each word

Is there a way to count the number of words in a string input at the start of a program and use that number as number of command line arguments in a public static void main (String[] args) program? The assignment says: Write a program with which you…
-3
votes
1 answer

pass Functions to main method Arguments

I have just started learning c# and need some help please I have a task that i need to declare 2 functions to add/subtract and needs to be passed through to main method [args], idea is in cmd i can press 1 or 2 to pass on a particular method. I then…
Jaz Bansal
  • 13
  • 1
  • 5
-3
votes
1 answer

Args invalid syntax python

Why is the invalid syntax and how can I actually fix this? I have import sys import yaml import threading import argparse from math import pi And later on I have with args.config as f: config - yaml.load(f) However every time I try to run it…
STKN
  • 1
-3
votes
2 answers

How should the parameter of the main method be documented

How should I document the parameter of the following method? public static void main (String[] args) throws IOException Should I use @param?
1 2 3
59
60