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
2 answers

Returning type casted array to main function

I am calling foo() function from main file whose return type is char*. from foo() I am returning int array by typecasting "(char*)ar". ar is array of size 2. Now I can retreive ar[0] in main() not ar[1](gives special char). foo.c #include…
user123
  • 5,269
  • 16
  • 73
  • 121
3
votes
1 answer

Create a Mac Application Installer and Passing Arguments on Launch

Couple questions on creating a mac installer. 1) Should any frameworks from /Developer/SDKs/ be included/packaged into the application file? 2) When we normally launch the executable we pass it an argument to point it at our servers, is there a way…
Allen
  • 71
  • 1
  • 3
3
votes
7 answers

C++ member function pointer with different arguments - or is this bad anyway?

Even though I fear that you will tell me that this topic was covered several time, I dare to ask it, since I was not able to generate a solution. Probably I was just looking for the wrong thing... Assume that I have a function which receives a…
Chris
  • 981
  • 4
  • 14
  • 29
3
votes
2 answers

JavaFX: Pass arguments from JavaScript to JNLP

I am trying to deploy JavaFX 2 app using Java Web start (generated by NetBeans) and I need to pass some args to my app using JavaScript. First question: Is it even possible? Second question: If it is possible, how can I do it. :-) My JNLP file…
user1498611
  • 324
  • 4
  • 15
3
votes
1 answer

Google Charts API: adding arguments to existing callback

I have a page with a number of charts generated from a Google spreadsheet. Typical code looks like this: var url = "http://my.googlespreadsheet.com/tq?argumentshereblahblahblah"; // create and send off the query var query = new…
i alarmed alien
  • 9,412
  • 3
  • 27
  • 40
3
votes
1 answer

Wrong value after setting (scalar) kernel argument OpenCL

I'm working on an OpenCL program, but the output is different each execution. I think it has to do with passing arguments to the kernel, because when I hardcode the values for a specific execution, the output is similar after each execution. My…
Balanidhren
  • 31
  • 1
  • 2
3
votes
2 answers

Trouble passing on an argument to function within own function

I am writing a function in which I want to pass some arguments to the crrstep-function ('crrstep' package), but I encountered a problem: somehow the argument 'event' in my function is not recognized when I enter it in crrstep. I guess that crrstep…
Rob
  • 1,460
  • 2
  • 16
  • 23
3
votes
6 answers

Set the name of a python object/variable with a string

Most people will probably say this is a bad idea. I want to use the content of a string as the name of a variable. I want to accomplish the dreaded: s = 'x' x = 1 where the variable name x comes (somehow?) from the string s. To answer the "why?",…
Andrew Youdin
  • 83
  • 1
  • 1
  • 6
3
votes
1 answer

Passing a non-const multidimensional array to a function which doesn't change it

Possible Duplicate: why isnt it legal to convert (pointer to pointer to non-const) to a (pointer to pointer to a const) I have am writing a function which takes a 2D array as input, and does not change the underlying values, and I wanted to…
3
votes
1 answer

How To detect empty argument list for variadric function (va_arg, va_end, va_start)

I have a function that encapsulate the CString::FormatV function, and I need to be able to detect if an empty parameter list is passed to the function. What's the best way to do this? My current code goes like this CString ADString::Format(CString…
Goldorak84
  • 3,714
  • 3
  • 38
  • 62
3
votes
1 answer

Bash: iterating over argument files

This could be a simple answer, but after Googling around I might just have the terminology down so I have yet to find anything about what I am asking. When accepting an argument such as /bin/*.txt how do you iterate through each of the files? I have…
user1470511
  • 339
  • 1
  • 3
  • 14
3
votes
1 answer

jQuery - building dynamic if statements based on object passed as the function argument

I'm trying to build several dynamic if statements based on the definition in the argument of the function. I should be able to run them if the particular keys and vales are provided. I can read all the keys and values, but not sure how to build a…
mwo
  • 85
  • 1
  • 7
3
votes
4 answers

How to check if an argument is an object (and not an array) in JavaScript

After testing out instasnceof I found that it will return true if the argument is an array or an object literal. function test(options){ if(options instanceof Object){alert('yes')}//this will alert for both arrays and object…
zero
  • 2,999
  • 9
  • 42
  • 67
3
votes
1 answer

Argument passing in Matlab

I have a function in matlab of the form fun(a,b,c), wherethe using may or may not give argument 'c' when he calls the function. I have to use a switch case on 'c' later in that function, and thus need to check whether user called the function with…
Vishal
  • 989
  • 2
  • 11
  • 19
3
votes
1 answer

String::ShellQuote: when do I need `shell_quote`?

Does it make sense to use shell_qoute from String::ShellQuote when I pass the arguments to system this way? #!/usr/bin/env perl use warnings; use 5.012; use String::ShellQuote qw(shell_quote); my $file = shift; my $argument = shift; $file =…
sid_com
  • 24,137
  • 26
  • 96
  • 187