argument-passing

How do I call a function with a variable number of parameters?

How do I call execlp() with a variable number of arguments for different processes? ...

Open multiple files using arguments

Hi, I'm using this code to load multiple files using windows context menu, but the problem is that the aplication is open many times as files the user has selected. For example: If I select 14 files, an open them with the application, the aplicacion is opened 14 times and load the form only one. But there is a way to send all argument...

Char array pointer vs string refrence in params

Hi. I often see the following structure, especially in constructors: class::class(const string &filename) { } class::class(const char * const filename) { } By step-by-step debug, I found out the 2nd constructor is always called if I pass a hard-coded string. Any idea: 1) Why the dual structure is used? 2) What is the speed diffe...

Pass a variable number of arguments to an aliased function.

Take a function like printf that accepts a variable number of arguments what I would like to do is pass these variable number of functions to a sub function without changing their order. An example of this would be aliasing the printf function to a function called console ... #include <stdio.h> void console(const char *_sFormat, ...);...

How do you handle multi-argument JavaScript functions?

I have defined my JavaScript function as follows: function printCompanyName(company1, company2, company3, company4, company5) { document.write("<p>" + company1 + "</p>"); document.write("<p>" + company2 + "</p>"); document.write("<p>" + company3 + "</p>"); document.write("<p>" + company4 + "</p>"); document.write("<p>" + company5 + "</p...

Question on Call-By-Reference ?

main() calls Call_By_Test() function with argument parameter First Node. I have freed the First Node in Call_By_Test() but First node address not freed in main(), why ?. typedef struct LinkList{ int data; struct LinkList *next; }mynode; void Call_By_Test(mynode * first) { free(first->next); first->next = (mynode *)NULL;...

Can you call a servlet with a link

Can you call a servlet with a link (i.e. link text And possibly pass parameters to the request object by adding them to the querystring. If not, I have seen this kind of thing: RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(/MyServlet); dispatcher.include(request,response); But how would I trigger ...

C Arguments Not Working?

Why doesn't this work? When I try to use -l or -s as the first argument, the if statements don't take. They always go to the else statement. #include <stdio.h> #include <fcntl.h> #include <errno.h> #include <string.h> #include <stdlib.h> int main(int argc, char* argv[]) { if (argv[1] == "-l") { printf("Yay!\n"); } ...

Trying to pass CGrect to performSelector withObject

Hi, I'm trying to pass a CGRect: SEL frameSel = NSSelectorFromString(@"setFrame:"); CGRect rect = CGRectMake(10, 10, 200, 100); [object performSelector:frameSel withObject:rect ]; But this does not compile I also tried: SEL frameSel = NSSelectorFromString(@"setFrame:"); CGRect rect = CGRectMake(10, 10, 200, 100); NSValue * value = ...

How do I pass arguments to C++ functions when I call them from inline assembly.

So, I would like to be able to call functions from a c++ dll. For certain reasons, I would like to call them from an __asm block in my C++ code. My question is this: I know that before I call the function, I have to push its arguments on the stack in the order specified by the function's calling convention.However, can i simply do someth...

Pass multiple files / folders from windows explorer to external application

Hi does anyone know how to get windows explorer to pass multiple files / folders through to an external app (c#) referenced in the registry? I am current able to act upon a single file / folder using the %1 syntax but not sure how to get explorer to pass through multiple items. Does anyone know how to do this? ...

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 determines how the data is sorted. This filter has a klass param and calls klass.set_filte...

Java variable number or arguments for a method

Can you tell me if I am correct in this question? It's a homework question, I don't want the answer. I just want to make sure that I am correct. It is possible to declare a method that will allow a variable number of parameters. The symbolism used in the definition that indicate that the method should allow a variable number of paramet...

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); ...

Pointer argument to boost python

What's the best way to make a function that has pointer as argument work with boost python? I see there are many possibilities for return values in the docs, but I don't know how to do it with arguments. void Tesuto::testp(std::string* s) { if (!s) cout << " NULL s" << endl; else cout << s << endl; } >>> t.testp...

Calling cdecl Functions That Have Different Number of Arguments

I have functions that I wish to call based on some input. Each function has different number of arguments. In other words, if (strcmp(str, "funcA") == 0) funcA(a, b, c); else if (strcmp(str, "funcB") == 0) funcB(d); else if (strcmp(str, "funcC") == 0) funcC(f, g); This is a bit bulky and hard to maintain. Ideally, these are variadic f...

trying to pass file name from aspx page to console.exe

i want to pass the value of a lable or textbox in an aspx page to a console.exe application such that the if the value is sample.doc it changes to that. i am calling from the aspx page with string f = TextBox1.Text; System.Diagnostics.Process.Start("C:/DocUpload/ConsoleApplication1.exe", f); i have tried converting to string ...

Cost of using repeated parameters

I consider refactoring few method signatures that currently take parameter of type List or Set of concrete classes --List[Foo]-- to use repeated parameters instead: Foo*. Update: Following reasoning is flawed, move along... This would allow me to use the same method name and overload it based on the parameter type. This was not po...

Invoke Java via Batch File with Filepath Arguments

Hi there, I'm having an issue getting files loaded into an app called GCS, by dragging them onto the executable. GCS can be invoked on Windows with a bat file, which goes like this: @echo off start javaw -Xmx256M -jar "GURPS Character Sheet.app/Contents/Resources/Java/GCS.jar" %* If I hard code a filepath in place of the batch argumen...

Passing array by ref.

Ref. to my last post and sellibitze's comment to that post on passing array by ref rather than by value, why is it that when I'm passing array by value compiler can deduce arguments but it won't do it if I pass it by value? template<class T,int row, int col> void invert(T (&a)[row][col]) //NOTE AMPERSAND in main with declaration above...