Questions tagged [command-line-arguments]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
13 views

Argument list in c

what is an argument list in c? Please I need a very simple explanation that if possible I'll remember for life! also... show me one containing an array
Gold Isaac's user avatar
0 votes
1 answer
402 views

debug50 won't run with command line arguments

Does anyone know why debug50 doesn't run when code takes command-line arguments instead of prompts the user within main? Is there a workaround for this? Every time I want to try out part of my code ...
Joseph J Filoramo's user avatar
0 votes
1 answer
59 views

Help with Either Command Line Argument or Arrays for Problem set 2 Caesar

I am on Problem Set 2: Caesar. Right now I'm trying to write code that first checks if the second command line argument is a int and if it does prints the integer. I got my program to compile after ...
Dre Johnson's user avatar
0 votes
1 answer
45 views

Why does `size` = `0` occur?

I've been trying PSet4's Recover. I've been trying to obtain the size of the entered file (card.raw) but unfortunately size gives and output of 0. Here's the code that I've made to find the file's ...
MelPradeep's user avatar
0 votes
1 answer
18 views

Strange CL output

I was testing my code to see if the command line argument's characters are digits but after plugging a random argument that was a mix of letters and numbers, I obtained a strange output. See what you ...
tinomutendaishe msakwa's user avatar
0 votes
1 answer
60 views

pset7 houses printing the error message if wrong usage

The commandline argument check in roster.py: A bit strange, I find whatever I am doing I can't get this error message to print, the function will shut down alright, but no error message, I have tried ...
HoopsLoops's user avatar
0 votes
1 answer
23 views

Command-line validation key

I cannot figure out why am I getting these results? I'm currently only trying to validate the Numeric Key when typing 20x as a command-line argument get Usage: ./caesar Key #include <cs50.h> #...
Laureano Jos Gutirrez Vallenil's user avatar
0 votes
1 answer
71 views

Pset3: Plurality; Code doesn't consider command line arguments expect the first one!

I don't understand why my code only considers the first command line argument and shows "Invalid Input" for rest of the arguments upon passing other argument's name while voting. Here is the code ...
Ishan's user avatar
  • 3
0 votes
1 answer
16 views

Arguments of the main function

I have a question about these two different mini-programs: #include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(void)...
hli's user avatar
  • 3
0 votes
1 answer
61 views

What does argc and argv have to do with cryptography? Why are we learning about these arguments?

I understand what these arguments do--take inputs before the program starts to in some way influence the program. But they seem to have been shoe-horned into the lecture. David moves on from this ...
Tanishq Kumar's user avatar
0 votes
1 answer
100 views

CS50 Vigenere Segmentation Fault

I'm stuck on this for days. I've also tried other answers on this question but still not able to understand what's causing Segmentation Fault when I enter a string as key after ./vigenere. Here's my ...
itsec80's user avatar
0 votes
1 answer
326 views

PSET 2 Caesar: Help getting key from user (one line)

I am currently on CS50x’s PSET2, Caesar, trying to get a key from the user (the first step pretty much). I need to get the key from the user. I understand that it will be a string stored in argv2 and ...
chocopie645's user avatar
0 votes
1 answer
426 views

command line arguments help to use them in the program

I'm not sure how to include the input from the command-line arguement. I try to set the arguments equal to variables, bu it's not working. #include <stdio.h> #include <cs50.h> int main(...
Ari Kalmen's user avatar
0 votes
1 answer
34 views

not satisfying the condition for input

In command line argument,it should not accept argv[1] as a numeric or any other.It should accept only alphabetic and that argv[1] is treated as key which is to be added with plaintext.so,for that i ...
Nohitha reddy's user avatar
0 votes
1 answer
416 views

CS50 PSET2 code will not compile

I would appreciate any help that could be given with my code below (+ error codes below that): My code will not compile and the primary error apparently is an "undeclared identifier" refering to ...
Pot Noodle's user avatar
0 votes
1 answer
4k views

null pointer passed as argument 1

I had written this function for argument checking but it is showing this type of error vigenere.c:26:20: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/...
Rahul's user avatar
  • 252
0 votes
1 answer
222 views

String validity check when string is command line argument?

We check the string validity when we use the get_string() function. Example: if (p != NULL) Are we also supposed to check string validity when the string is entered as a command line argument?
Satanic Saint's user avatar
0 votes
2 answers
97 views

Pset 2 - Vigenere Checking Command Line Input

I am working on the Vigenere portion of the pset and appear to have it totally working, yet when I ran the checker I realized that I had not created a test for non-alphabet characters in the command ...
mlh's user avatar
  • 3
0 votes
1 answer
23 views

What is `all:` command?

I encountered a problem while using all command (or variable if : is used to create one) during problem set 3. bash: all:: command not found The context is building both generate and find (two files ...
Revolucion for Monica's user avatar
0 votes
1 answer
75 views

is `key` in `./caesar key` my second or third command-line argument?

I don't need help with the pset, since I have finished already. in caesar, I was getting a segmentation fault. after changing argv[2] to argv[1], the problem was solved. My question is: if I my ...
kamcho 56's user avatar
0 votes
1 answer
202 views

Command Line Arguments - argc and argv[]

Since argc gives the number of command line arguments, which is the length of argv[] why should the square brackets be empty? Can I not write main function signature as int main(int argc, string argv[...
Pooja's user avatar
  • 139
0 votes
2 answers
56 views

Question on pset2 youtube video(command-line argument)

It is one of pset2 youtube video instruction about command-line argument. address is following, https://youtu.be/X8PmYwnbLKM In 6:56, it shows code like this. int main(int argc, char*argv[]) { for(...
jayko03's user avatar
  • 109
0 votes
2 answers
2k views

PSET5 Dictionary - error : Could not open texts files

I have a problem to open texts files related to pset5. I think that is nothing to do with my code. It's probably the way I ask in the command window or maybe my current directory. Is it the good way ...
CharlesD89's user avatar
0 votes
1 answer
123 views

caesar.c command line argument not stored in argv

This is about Problem Set 2, week 3, caesar.c. My code doesn't store the int I get from the user via GetInt() in argv. Consequently, argc stays at value 1 and the one command line argument given by ...
swissfritz's user avatar
0 votes
1 answer
238 views

Can anyone give me an example of code without a command-line-argument and code with a command-line-argument?

After watching the lectures, walkthrough and notes of the lectures It is still not clear to me what purpose a command-line-argument got exactly. I hope if someone can give me an example of code with ...
Kiwi's user avatar
  • 179
0 votes
1 answer
35 views

Main argument input definitions

Is it possible to use the main function to define what an input can be? int main(int argc, string argv[]) For example, within the argv[], the number of arguments can be defined to 1, 2, 3, etc. Can ...
Derek Roberts's user avatar
0 votes
2 answers
326 views

Command line argument - buffer over read

It was discussed one of the starting lectures that when using main method with command line arguments (int argc, string argv[]) then argv can be used to access memory location which is not intended to ...
hagrawal7777's user avatar
0 votes
0 answers
113 views

how to pass arguments to copy file program?

i am learning on study50 regarding file io. the exercise asks us to write a program to copy a file. I have written the code correctly for this program. I have named this cp.c and usage cp source ...
Hoshiyar Singh Digari's user avatar
0 votes
2 answers
306 views

Check50 message "Can't check until the frown turns upside down"

jharvard@appliance (~/Dropbox/pset2): ./caesar 13 Be sure to drink your Ovaltine! Or fher gb qevax lbhe Binygvar! This assignment required to execute like the above. However, if using int main (int ...
Taz's user avatar
  • 1
0 votes
2 answers
63 views

Do I have to return a value when checking all command line arguments

When programming functions or checking command line arguments, is it necessary to return always return a value? For functions that are casted as an int, we must return 0 when the program runs and ...
Lucas's user avatar
  • 171
1 vote
1 answer
132 views

How do I ensure that the user input in greedy is given to two decimal places?

I have a question about 'Greedy' in pset1. How do I ensure that the input I'm given by the user is in the correct format, namely to two decimal places like 0.00?
fuego pazzo's user avatar
0 votes
1 answer
550 views

int GetInt(void) and command line arguments

Why don't the Get functions, GetString, GetInt etc, take command line arguments like the main function? It seems to me that they should since command lines are being inputed into the function.
William Kenney's user avatar
0 votes
3 answers
2k views

Segmentation Fault and Returning 1

If I declare int key before my if (argc != 2), I get a segmentation fault (core dumped) message when I run the program with only one command-line argument. However if I declared int key after the if ...
Adam Wilson's user avatar