argv Questions
3
Solved
6
Solved
I want to use the following code, but without indexing the array with"[][]" and substitute it with pointers
for (int i = 0; i < argc; i++) {
for (int j = 0; argv[i][j] != '\0'; j++) {
//code
...
2
Solved
Inspired by another question here, I would like to retrieve the Python interpreter's full command line in a portable way. That is, I want to get the original argv of the interpreter, not the sys.ar...
Antilebanon asked 5/2, 2015 at 4:49
5
this is how we use MPI_Init function
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
…
}
why does MPI_Init use pointers to argc and argv instead of values of argv?
3
Solved
I have written a little Python script that checks for arguments and prints them if enough arguments or warnings if not enough or no arguments. But by default, the script itself is one of the argume...
4
Solved
I wonder what the abbreviation envp stands for, for example here:
int main(int argc, char **argv, char **envp);
I also wonder what the v in argv initially stood for. Was the v for "value"...
Mallon asked 16/2, 2019 at 13:31
8
Solved
When passing argument to main() in a C or C++ application, will argv[0] always be the name of the executable? Or is this just a common convention and not guaranteed to be true 100% of the time?
Kristelkristen asked 12/1, 2010 at 17:31
7
I'm writing an application that takes arbitrary command line arguments, and then passes them onto a python function:
$ myscript.py --arg1=1 --arg2=foobar --arg1=4
and then inside myscript.py:
i...
Brandonbrandt asked 9/10, 2012 at 19:59
5
Solved
If I want to keep the bulk of my code for processing command line arguments out of main (for organization and more readable code), what would be the best way to do it?
void main(int argc, char* ar...
4
Solved
I have a script "task.sh" with the following content:
#!/bin/bash
CUR_DIR=`pwd`
SCRIPTPATH="${CUR_DIR}/`dirname $0`"
when I call it with "bash task.sh" it works as expected but when it is call...
2
I'm using exec() to exec a file but the file is in a class, I read more about argv but it was confusing. I need to get it to work inside a class.
It says:
Please note that, $argv and $argc need...
3
Solved
I have a C program that reads command line arguments from argv. Is it possible to make a pipe to redirect the contents of a file as command line arguments to my program? Suppose I have a file argum...
Isia asked 5/7, 2011 at 15:20
3
Solved
I have written a small program that takes some input parameters from *argv[] and prints them. In almost all use cases my code works perfectly fine. A problem only arises when I use more than one ex...
3
Solved
I am currently trying to grasp the exact name of argv function (if it can be called a function) that can be imported from sys or system-specific parameters. I found 3 definitions:
argument vector...
Takakotakakura asked 18/10, 2017 at 12:41
2
Solved
I'm using a shared host (fasthostingdirect) and for some reason they have this flag turned off by default. This means I'm unable to access PHP command line parameters... unless I use the -n (= --no...
Epigene asked 12/7, 2012 at 20:19
1
2
I know how to check whether required arguments are given on the command line. But how do I check whether the given argument on the command line actually refers to an existing file in the fold...
Flibbertigibbet asked 17/7, 2017 at 14:29
6
Solved
I am familiar with C, and have started experimenting in python. My question is regarding the sys.argv command. I've read it is used for a command line interpreter, but when trying to execute a simp...
4
Solved
My application has entry point
int main(int argc, char *argv[])
{
}
I need to extend *argv array to n+1 and append a value. For example, I need to append "-app_ver".
I'm a newcomer in C++ (wit...
Anglicism asked 12/4, 2017 at 14:20
2
Solved
I recently made minor changes to previously-working code, and the program now immediately encounters a segmentation fault upon execution. In fact, it doesn't even make it to the first line in...
Toritorie asked 25/2, 2017 at 5:28
4
Solved
What I have understand about passing arguments to main() from command line is that argc has a minimum value of 1 and argv[0] will always have the program name with its path in it.
If arguments are ...
4
CODE 1
#include<stdio.h>
int main(int argc, char *argv[])
{
int j;
printf("%d", argv[1][0]);
return 0;
}
CODE 2
#include<stdio.h>
int main(int argc, char **argv)
{
int j;
pr...
Rodl asked 30/11, 2014 at 13:10
3
Solved
Is it possible to execute a process whose argc = 0? I need to execute a program but it is extremely important for its argc to be equal to 0. Is there a way to do that?
I tried to put 2^32 arguments...
Jungly asked 13/11, 2011 at 18:46
2
Solved
Hi very newbie question but I just can't figure it out:
I have a function named bar
class foo
{
public:
bool bar(int argc, char** argv);
}
argv is supposed to contain
"--dir" and "/som...
3
I'm working on simulating computer networks using "NS2 Simulator". I don't really understand why we should use const char* const* argv instead of char *?
Can I use char * instead of that? T...
© 2022 - 2024 — McMap. All rights reserved.