Questions tagged [argument-passing]

Argument-passing may refer to two different things: (1) the process of providing a program being started with some initial pieces of information (the arguments) on its command line; (2) the process of providing the initial values (the arguments) for the parameters of a function when it is called.

777 questions
3
votes
3 answers

Executing a command from C++, What is expected in argv[0]?

I am using execv() to run commands from /bin/ such as 'ls', 'pwd', 'echo' from my c++ program, and I am wondering what value I should provide in argv[0]; const char * path = getPath(); char ** argv = getArgs(); execv(path,argv);
Tom Neyland
  • 6,860
  • 2
  • 36
  • 52
3
votes
2 answers

Passing arguments to filters - best practices

What better ways to pass arguments to filters in Rails controllers? EDIT: The filter has a different behavior depending on the parameters passed to it, or depends on the parameters to perform its action. I have an example in my app, where a filter…
nanda
  • 1,313
  • 9
  • 16
3
votes
4 answers

How do I print out which arguments a Python function requires/allows?

Suppose I have a function and I want to print out the arguments it accepts. How can I do this?
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
3
votes
1 answer

How do I set preschedule=FALSE for llply's parallel mode?

I want to use llply to perform some parallel computations using the multicore doParallel backend (i.e. doParallel::registerDoParallel(cores=8)), but each computation will take a different amount of time, so I want to set the multicore preschedule…
Ryan C. Thompson
  • 40,856
  • 28
  • 97
  • 159
3
votes
2 answers

Open application and pass arguments from hyper-link in email

This is all done internally with trusted/full access. How can I open my application from a hyper-link in an email and pass arguments? I understand I can set up a file/link type association (although I'm unsure how to do this programmatically or…
GJKH
  • 1,715
  • 13
  • 30
3
votes
1 answer

How to handle Laravel 4 sub-domain route with controller, passing subdomain as an argument

Following the Laravel 4 documentation on Routing, I've been trying to create a domain route that will handle a wildcard subdomain and pass it over to a controller action, but I'm having trouble passing the argument. Route::group(array('domain' =>…
3
votes
2 answers

How to pass multiple arguments to a smarty function?

I've a following code snippet from smarty template: The following is the function body:
user2838698
3
votes
3 answers

When to use reference in C++?

I am always in a doubt on when I should reference and when I should use a variable pass. For example, one of the API is called by the JOBJECTs - QLIST retrive_cinemas(QString& options) { return (staticobject::getcinemas(options)); } or QLIST…
dexterous
  • 6,422
  • 12
  • 51
  • 99
3
votes
4 answers

Moving arguments or passing them the usual C++98/03 way?

Suppose that there is a Person class like this: // "string" is std::string, "move" is std::move class Person { public: // C++11 way: pass by value and std::move() from the value Person(string name, string surname) :…
Mr.C64
  • 41,637
  • 14
  • 86
  • 162
3
votes
2 answers

C# - Method For Determining If Arguments Have Been Passed Fails

I am creating a Windows Forms Application with c# that can open up a file on startup if it is passed an argument containing the path to the file. However, it doesn't accurately determine if arguments have been passed. Even when I pass no arguments,…
Igor
  • 548
  • 3
  • 7
  • 24
3
votes
2 answers

How do I pass an array of functions as argument if size of array isn't known

Here's a simple (and a silly one, yeah) example of what I'm trying to do: #include void callFunctionsFromAnArray(void *(*)(int), int); void f1(int); void f2(int); void f3(int); int main() { const int n = 3; void (*functions[n])…
Anhil
  • 65
  • 1
  • 6
3
votes
2 answers

How to use the content of the kill-ring as the prefix-arg for universal-argument?

Sometimes I want to be able to do the following: "C-u xxx ..." where xxx is the integer which I did last put into the kill-ring (by killing a number in my buffer). It's something I'd like to use with a macro so I can't enter that integer…
Cedric Martin
  • 5,945
  • 4
  • 34
  • 66
3
votes
4 answers

How to pass arguments to REXX program through JCL

Can we pass arguments to a REXX program from JCL? I suppose, JCL PARM can be used as we use for passing arguments to COBOL programs.. Do put your ideas here...
Raja Reddy
  • 772
  • 8
  • 19
  • 37
3
votes
3 answers

How do I globally change a variable value within function in lisp

I would like to know if there is any way to mimic C behaviour with pointers in LISP. In C if you change a value of a variable, that pointer is pointing to, it has a global effect (i.e. the value will be changed outside the function too). So if I had…
smihael
  • 863
  • 13
  • 29
3
votes
1 answer

error: invalid initialization of non-const reference of type 'cv::Mat&'

The below is my function prototype. void devectorize(Mat &vec,Mat mask,Mat& img); I am getting the below error when I try to call this function in my code. What would be the reason? Mat V; for(int i=0;i
user2727765
  • 616
  • 1
  • 12
  • 28