Questions tagged [argv]

The tag has no usage guidance.

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

PSET2 Caesar - Stuck at 'isdigit' step: Do I need to learn about pointers, or is something else going on?

Here is what I am attempting, and my errors. I am gathering that I am not grasping the "array of strings nature of argv[], and since I am following along with the material from class, I am pretty ...
0
votes
1answer
10 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 ...
0
votes
1answer
54 views

Having problems with Pset2, argv[1]: program doesn't 'see' it

I'm having a problem with argv[]: the code doesn't seem to 'see' it!! With a key that's either too long or too short, the program behaves as expected (prints out error message, exits). But if I input ...
0
votes
1answer
182 views

Checking a string to see if it's an integer

I'm currently working on Caesar and I'm trying to go through each step in turn to complete it. As the problem set requires, I've written code that runs from the command line. The code below ...
0
votes
1answer
49 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 ...
0
votes
1answer
99 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 ...
0
votes
1answer
282 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 ...
0
votes
1answer
32 views

Resize infile won't read from argv

When I try to assign char *infile to argv[2] all that I infile ends up being is "". In that first for loop it prints fine but it won't work with the infile. The outfile also doesn't have any problems ...
4
votes
1answer
1k views

pset6 - caesar - check50 error: “expected exit code 1, not 0”

I scored the web after an answer, found it, but still doesn't work. My caesar.py works fine, check50 shows me all happy faces except the last: :( handles lack of argv[1] expected exit code 1, not ...
1
vote
2answers
2k views

error: unused parameter 'argv'

I am writing this simple code for checking if the user has entered the key or not. If not I want to return 1 and show an error msg. Below is the snapshot of my code which I am using. I am getting the ...
0
votes
1answer
179 views

length of argv always change to 1?

why the length of argv changed here to 1 always in the last line ?? #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(int argc, string argv[...
0
votes
2answers
30 views

argv returning session ID string

Within a nested 'for' loop, I am printing 'argv[i][j]' as a sequence of chars. I expect the program name (vig) to be printed in the format it was typed at the command line (./vig). And it is. ...
0
votes
1answer
30 views

week3 lecture very beginning

Week3 Lecture: A student asked a question of my mind how do computer know about the argc ? I really don't understand how is this argc working In case we printed "zymla" we gave argv[1] as our first ...
0
votes
3answers
508 views

Assing argv[1] to a string variable (vigenere)

I'm stuck. There's a way to assign argv[1] to a string variable?, like: string keyword = argv[1];
0
votes
1answer
409 views

Error return 1? Caesar

Okay, this is a part of my caesar code, and I don't think I am getting what the graders are trying to tell me. The output I gave them was not what they said that I am giving them Code #include <...
0
votes
2answers
389 views

How to check string argv[] for errors?

hope I can get some help here. I'm only at week 3 in CS50 and wanted to play around with command-line arguments a bit before moving on. I got this working (diagonalizing input), but couldn't figure ...
0
votes
1answer
190 views

argv, getting: EXC_BAD_ACCESS (code=0, address 0x0)

First off, I don't have the appliance, I had to place cs50.h in the same directory as my source code. As you will see from my code I did provide the correct header for that situation. The error in ...
4
votes
2answers
2k views

How to handle “lack of argv[1]”

I have my code set up so that if argc doesn't equal 2 the main function will return 1. Per the specs I thought. But I keep getting the error that I didn't "handle lack of argv[1]". if (argc != 2) ...
0
votes
2answers
2k views

Can someone explain me the point of the “int k = atoi((argv[1]);”?

I know that the answer seems obvious but I will explain further the reason for my question: in my program I only used for the key int k = GetInt() without the argv, argc etc. and the program seems to ...
0
votes
1answer
995 views

char* text = (argc == 3) ? argv[2] : argv[1];

Could someone explain me what the line in the title actually does? Am I correct if argc is 3 char* text is argv[2] else char* text is argv[1] ? If so, how do the operators work in this ...