argv

how to change the name of a Java application process?

a 夏天 提交于 2019-12-17 03:39:52
问题 When executing a Java application the process name given to it is usually java.exe or javaw.exe . But how can I make it be called by the name of my application? 回答1: These methods are suited for servers with a lot of java processes running, and where you need a quick way of finding the correct jvm (not using jps.) For applications, I suppose launch4j or another wrapper is the way to go. On unix, If you are launching from a shell sript (at least for bash and possibly for other decent shells)

how to change the name of a Java application process?

亡梦爱人 提交于 2019-12-17 03:39:30
问题 When executing a Java application the process name given to it is usually java.exe or javaw.exe . But how can I make it be called by the name of my application? 回答1: These methods are suited for servers with a lot of java processes running, and where you need a quick way of finding the correct jvm (not using jps.) For applications, I suppose launch4j or another wrapper is the way to go. On unix, If you are launching from a shell sript (at least for bash and possibly for other decent shells)

Python send data to an executable passed as parameter in terminal

时光总嘲笑我的痴心妄想 提交于 2019-12-14 03:18:04
问题 I have a python script which gets 2 parameters from the command line, an executable and a file. After I do some computation I need to pass by stdin the result of this computation to the executable. 1) is this even possible? 2) if so, how can I do this in Python 回答1: First, you should never use os.system that's a very dangerous and bad habit. As for your problem, using subprocess you can do the following: from subprocess import Popen, PIPE, STDOUT #do some stuff data = do_some_computation_from

Passing arguments to executable from command line

风流意气都作罢 提交于 2019-12-14 02:15:42
问题 I'm trying to pass arguments to a Fortran executable from the command line. A sample program that achieves this in C is (taken from here): #include <stdio.h> int main (int argc, char *argv[]) { int count; printf ("This program was called with \"%s\".\n",argv[0]); if (argc > 1) { for (count = 1; count < argc; count++) { printf("argv[%d] = %s\n", count, argv[count]); } } else { printf("The command had no other arguments.\n"); } return 0; } The output of this program is: This program was called

Arguments in main() ignored when debugging in Visual C++

限于喜欢 提交于 2019-12-14 01:22:42
问题 Up to this point I've been able to correctly view the output of my C codes by using the debugging command in Visual C++. However, when the script relies on parameters in the main function (eg/ argc , argv ), the debugger seems to ignore both parameters and treat them as though they are uninitialized. For instance, in the following code, the output is always printf("Usage: find pattern\n"); . #include <stdio.h> #include <string.h> #define MAXLINE 1000 int getline(char *line, int max); /* find:

C: Accessing the second argv via a pointer

别等时光非礼了梦想. 提交于 2019-12-13 17:25:09
问题 As I'm quite new to C, there's something I don't yet get about pointers. I'd like to check wether a command line argument is integer or not, but in a separate function, so that I pass in the pointer of the argv array. int main(int argc, char* argv[]){ if(check(argv)){ // Do stuff to argv[1] } } int check(char* p){ // Test wether p+1 is int return 1; } I have tried several things mostly resulting in weird printf's (when printing the dereferenced pointer to test the value). int i = atoi(argv[1]

Checking to make sure argv[1] is an integer c++

断了今生、忘了曾经 提交于 2019-12-13 16:47:05
问题 For my program I have to make sure the user only inputs a positive INTEGER. for example if the user inputted 12hi it should not run the program and print to std error. I am not quite sure how to implement this. int main(int argc, char *argv[]) { if(atoi(argv[1]) < 1) { cerr << "ERROR!"<< endl; return 1; } return 0; } 回答1: Pass it to a std::istringstream and ensure all data was processed: if (a_argc > 1) { std::istringstream in(a_argv[1]); int i; if (in >> i && in.eof()) { std::cout << "Valid

Read a file using argv

不打扰是莪最后的温柔 提交于 2019-12-13 11:15:00
问题 Currently the code is reading the file and sort the records, as shown below, #include"fileIO/file.h" #define MAX_RECORD_SIZE 256 // Bad style typedef struct{ int age; char *lastName; char *firstName; }Person; ..... int main(int argc, char *argv[]){ FILE *pFile = fopen("file.txt", "r"); .... callInsertionSort(getItemList(cache), getSize(getItemList(cache)), less); } where, file.txt is, Age,LastName,FirstName 50,B,A 30,A,B 20,X,D 10,F,A 10,A,B 90,V,E 60,N,M Execution: $./sort.exe Before sorting

Sending and receiving character array using piping through argv in C

╄→尐↘猪︶ㄣ 提交于 2019-12-13 07:04:41
问题 So, I'm trying to create a pipe that sends char arrays back and forth through pipes that connect through argv[]. Right now, I'm stuck at receiving the array (param which is sent to c_param from the parent to the child.) in interface.c to receiving the characters 3 and 5 at db.c. I know that 3 and 5 are the index for argv[] that my pipes are at, but I'm not sure how to take that and print out my message in db.c. interface.c creates the pipes, forks into a parent process and a child process.

windows Python Name error

旧时模样 提交于 2019-12-12 01:54:01
问题 I am getting name error for this code. error message: Traceback (most recent call last): File "D:\injection.py", line 16, in opts, args = getopt.getopt(argv, "h", ["help", "target="]) NameError: name 'argv' is not defined #!/usr/bin/python import sys import getopt import urllib # define hexEncode function hexEncode = lambda x:"".join([hex(ord(c))[2:].zfill(2) for c in x]) def main(argv): # set defaults target = None # parse command line options try: opts, args = getopt.getopt(argv, "h", [