command-line-arguments

How can you debug across projects in VB.Net if one launches the other?

I have a VS 2008 Solution in VB.Net that has 2 projects - a Launcher and the App. The Launcher is what runs first, checks to make sure the App has all the latest files from the network, etc. and then launches the App. The Launcher allows the user to select their environment (Test, Production) then passes those values into the App.exe a...

Why does the following program give a error?

Why does the following program give a warning? Note: Its obvious that sending a normal pointer to a function requiring const pointer does not give any warning. #include <stdio.h> void sam(const char **p) { } int main(int argc, char **argv) { sam(argv); return 0; } I get the following error, In function `int main(int, char **...

How to determine a good value for -load-average using gnu Make ?

In Make this flag exists: -l [load], --load-average[=load] Specifies that no new jobs (commands) should be started if there are others jobs running and the load average is at least load (a floating-point number). With no argument, removes a previous load limit. Do you have a good strategy for what value to use for the load li...

c: program execution problem

Hi I wrote this code and compiled it, #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <time.h> // Data Structures typedef struct process{ char jobName; int arrivalTime; int execTime; struct process *next; } P; typedef struct result{ char Name; struct result *next; } result; // E...

how to parse main arguments ?

Hi How can I find this information : think we started this process : testFile.exe i- 100 k- "hello" j-"C:\" "D:\Images" f- "true" Now how can I get main argument when application started so I have : int i = ... ; //i will be 100 string k = ... ; // k = hello string[] path = ... ; // = path[0] = "C:\" , path[1] = "D:\Images" bool f...

Parsing command line arguments in R scripts

Is there any convenient way to automatically parse command line arguments passed to R scripts? Something like perl's Getopt::Long? ...

How can I get Perl's Getopt::Long to tell if arguments are missing?

I'm using Perl's Getopt::Long module to parse command line arguments. However, it seems that it returns a true value even if some of the arguments are missing. Is there a way to tell if this is the case? ...

Handling `argv` in a C command line program

I've read the first array member of argv will always be the program name. Is it ever useful to hang on to this? I'm learning, so forgive me please if it is a dumb question. Do people ever unshift the first member because it is useless (and reset argv to be one less?), or is leaving it there best practice because people expect it will a...

Command line Questions in R

I am building an user input interface in R. onload of the program, I would like like to ask the user what their preferences are according to a set of 6 fields. This will then be used as a comparison tool for the rest of the program. e.g., >ThisProgram >"Hello, on a scale of 1 to 10, how much would you say you rate the outdoors in y...

Command Line in Batch file?

I am making a batch file to automate mysql installation silently. When I type the following line in the command prompt everything works fine. "C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlinstanceconfig.exe" -i -q ServiceName="mydb" RootPassword="pos" ServerType=DEVELOPMENT DatabaseType=INNODB Port=3306 My question is: can I someh...

java netbeans commadline argument passing

I am passing a command line argument using Netbeans but I get an ArrayIndexOutOfBoundsException. My code is: public class CmdLineArgumentPassing { public static void main(String args[]) { System.out.println("Count : " + args.length); System.out.println("i : "+args[0]); } } The output is...

Why isn't main defined `main(int argc, std::vector<std::string> argv)` ?

This question is only half tongue-in-cheek. I sometimes dream of a world without naked arrays or c strings. If you're using c++, shouldn't the preferred definition of main be something like: int main(int argc, std::vector<std::string> argv) ? Edit: Even better: int main(std::vector<std::string> argv) There are already multiple d...

problem passing 0 as command-line argument

I've just noticed a strange behavior of perl5 (5.10.0) when I passed 0 as the command-line argument to a script, which assigns it to a variable. The problem I encountered is that if I give the variable a default value in my script which is greater than 0, say 1, then I can pass any value except 0 to override the default value 1. Follo...

How to start an external program with a file from a C program when both paths have spaces?

I'm trying to fix an existing C-program with VS2005 that eventually calls int system(command) //in C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\system.c) with parameter value start C:\Program Files\VideoLAN\VLC\vlc.exe C:\Documents and Settings\me\My Documents\My Music\09 - Track09.mp3 the program to be started and the ...

Ruby CLI app configuration / argument management

I'm currently working on a CLI app in Ruby, I'm using Trollop (http://trollop.rubyforge.org/) for dealing with cli arguments. I'd also like to implement the possibility of storing the required options in ~/.mycfg as well as cwd/.mycfg, the latter taking precedence. The behaviour I'm trying to implement is: If .mycfg exists in the curr...

Please help me shorten my code..

Hey guys, My question is to shorten repeating the process. Data1=dlmread('BadgCk-20001103-RZhS-1hAccumx10-TextData0-1.txt','\t',[31 1 286 255]); Data2=dlmread('BadgCk-20001103-RZhS-1hAccumx10-TextData0-1.txt','\t',[299 1 554 255]); Data3=dlmread('BadgCk-20001103-RZhS-1hAccumx10-TextData0-1.txt','\t',[567 1 822...

Is it possible to create a static library (single .lib file) that can be later compiled with either /MT, /MTd, /MD or /MDd?

Instead of creating 4 different libs (one for MT, MTd, MD, MDd) I want to create a lib that does not specify its dependency on C runtime library (CRTs). I tried to pass "/c /Zl" option to vc10 compiler, then /NODEFAULTLIB to lib command. Later when I use such lib I still have errors when I compile my program with switch different than d...

clear a given commandline string to match filepath

Hello, my application processes strings with commandlines. I need to get the string to the given executable that is called for example: "C:\windows\system32\notepad.exe bla.txt" => C:\windows\system32\notepad.exe "C:\windows\system32\ipconfig /all" => C:\windows\system32\ipconfig "D:\this is my path\thisismyexe.exe -l this -p are -m my ...

Command-line arguments as bytes instead of strings in python3

Hello, I'm writing a python3 program, that gets the names of files to process from command-line arguments. I'm confused regarding what is the proper way to handle different encodings. I think I'd rather consider filenames as bytes and not strings, since that avoids the danger of using an incorrect encoding. Indeed, some of my file name...

"$0 (Program Name) in Java? Discover main class?" again

Hello, I have found following question: http://stackoverflow.com/questions/41894/0-program-name-in-java-discover-main-class but accepted answer fails in this situation: public class Derived extends Base { } class Base { public static void main(String[] args){ System.out.println(getTheClassName()); } static String ...