3
votes
Accepted
What does argc and argv have to do with cryptography? Why are we learning about these arguments?
What do argc and argv have to do with the subject of cryptography? Nothing.
But they DO have a lot to do with how you get data into a program when it is started. Just in case you didn't ...
2
votes
Accepted
null pointer passed as argument 1
You forgot to include the relevant code.
You probably call your check function with a NULL pointer. This might happen for example if you use argv[1] before checking whether argc is greater than 1 (or ...
1
vote
Accepted
Why does `size` = `0` occur?
The code is working correctly. If it's giving a file size of 0, the file size really is zero. Maybe it was overwritten? If the file weren't there, it would gen an error.
Why are you getting a file ...
1
vote
Accepted
Strange CL output
I have no idea what this code is doing. But that doesn't really matter.
You said that the intent is to test the chars in argv[1] to see if they're digits. Well, there's absolutely no code here to do ...
1
vote
Accepted
Pset3: Plurality; Code doesn't consider command line arguments expect the first one!
Consider the for loop in your vote() function: It compares the candidate name with the name introduced by the voter. In the very first pass (i = 0) what happens when the candidate name and the name ...
1
vote
Accepted
CS50 Vigenere Segmentation Fault
It looks like it will fail here else if (isalpha(argv) == 0) (I did not read the code further).
argv is an array of strings. Review the man page for isalpha to be reminded that it takes a single ...
1
vote
Accepted
not satisfying the condition for input
The code is actually testing for non-alpha keys. The problem is that it is prompting for the plaintext before checking the key. It's a sequence issue.
As a side issue, consider how you might make the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
command-line-arguments × 33pset2 × 12
caesar × 8
array × 4
argv × 4
pset3 × 2
vigenere × 2
segmentation-fault × 2
string × 2
argc × 2
pset4 × 1
pset5 × 1
pset1 × 1
recover × 1
cs50x × 1
speller × 1
pset7 × 1
check50 × 1
c × 1
greedy × 1
error × 1
dictionary × 1
pset4recover × 1
crack × 1
function × 1