cs50

How to identify what is causing the Segmentation fault

两盒软妹~` 提交于 2021-02-05 09:42:44
问题 My code's aim is to take in 2 command line arguments (inclusive of programme name), and to print out responses as shown based on the given 2nd command line argument. If the command line argument is an integer, the user's input is accepted or "Success"and if it as anything else (e.g. a string or more than one command line argument), it will be Null and the error message will be shown. This is for CS50 caesar for those who are familiar My Code is as follows: #include <stdio.h> #include <cs50.h>

How to identify what is causing the Segmentation fault

强颜欢笑 提交于 2021-02-05 09:42:30
问题 My code's aim is to take in 2 command line arguments (inclusive of programme name), and to print out responses as shown based on the given 2nd command line argument. If the command line argument is an integer, the user's input is accepted or "Success"and if it as anything else (e.g. a string or more than one command line argument), it will be Null and the error message will be shown. This is for CS50 caesar for those who are familiar My Code is as follows: #include <stdio.h> #include <cs50.h>

cs50 pset7 13.sql - remove kevin from results

柔情痞子 提交于 2021-02-05 09:23:27
问题 UPDATE: I was able to easily and simply solve this problem by changing 2 things: Add to the end of the code: AND people.name != "Kevin Bacon" Change nested query to movies.id instead of title. Thanks to this thread for the answer: CS50 Pset 7 13.sql, I can't solve it, nested sqlite3 database I'm at the very last step of PSET7 movies (https://cs50.harvard.edu/x/2020/psets/7/movies/) The goal output should be all people that have starred in a movie with Kevin, but Kevin himself should NOT be

CS50 Speller Segmentation Fault Issue During Misspelled Words

不问归期 提交于 2021-02-05 08:41:21
问题 My code is causing a segmentation fault somewhere. I'm not entirely sure how. I don't think it's an issue with load, as the program begins listing off Misspelled words before abruptly stopping and giving me the seg fault error. // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "dictionary.h" #define HASHTABLE_SIZE 80000 unsigned int count = 0; // Represents a node in a hash table typedef

CS50 Recover (Pset4)- Images not Recovered

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-05 08:12:48
问题 So I'm trying CS50 Recover exercise (where you need to search for jpg files in a memory card and whenever you find one- you open a new file and write the jpg found to the new file). My code compiles but when I'm running the check50 command I'm receiving the following errors: :( recovers 000.jpg correctly recovered image does not match :( recovers middle images correctly recovered image does not match :( recovers 049.jpg correctly recovered image does not match Can somebody help me figure out

CS50 Recover (Pset4)- Images not Recovered

雨燕双飞 提交于 2021-02-05 08:11:42
问题 So I'm trying CS50 Recover exercise (where you need to search for jpg files in a memory card and whenever you find one- you open a new file and write the jpg found to the new file). My code compiles but when I'm running the check50 command I'm receiving the following errors: :( recovers 000.jpg correctly recovered image does not match :( recovers middle images correctly recovered image does not match :( recovers 049.jpg correctly recovered image does not match Can somebody help me figure out

cs50 pset4 Recover - why does writing entire file to memory fail check50?

和自甴很熟 提交于 2021-02-02 03:48:43
问题 I'm working on Recover and am wondering if there's something fundamentally flawed with my approach. The walkthrough suggests using fread() to go through a file in 512 byte chunks, look for JPEG headers, and write to a new file - 00X.jpg - each time one is found. What I tried instead was creating an arbitrarily large temporary buffer with malloc(), using fread()'s return value to determine the size of the file, and writing the entirety of the file to an array of structs with two data types; .B

cs50 pset4 Recover - why does writing entire file to memory fail check50?

情到浓时终转凉″ 提交于 2021-02-02 03:47:05
问题 I'm working on Recover and am wondering if there's something fundamentally flawed with my approach. The walkthrough suggests using fread() to go through a file in 512 byte chunks, look for JPEG headers, and write to a new file - 00X.jpg - each time one is found. What I tried instead was creating an arbitrarily large temporary buffer with malloc(), using fread()'s return value to determine the size of the file, and writing the entirety of the file to an array of structs with two data types; .B

CS50 PSET4 RECOVER - Unable to recover 001.jpg and file 0049.jpg recovered does not match

一个人想着一个人 提交于 2021-01-29 09:05:20
问题 I'm attempting the 'Recover' question on CS50's pset4. It appears that I am able to retrieve all of the images except for 001.jpg. I suspect that this further led to some misalignment with the numbering of the files given that check50 tells me the following:- :) recovers 000.jpg correctly :( recovers middle images correctly 001.jpg not found :( recovers 049.jpg correctly recovered image does not match To be clear, I was able to retrieve 000.jpg, followed immediately by files 002.jpg through

My recovered images don't match in CS50 PSET4 Recover

橙三吉。 提交于 2021-01-28 09:57:49
问题 I'm attempting the 'Recover' question on CS50's pset4. Though my code produced all 50 pictures, there is a bug as when I ran checkcs50, the first, middle, and 049 image doesn't match. To be clear, I was able to retrieve 000.jpg, followed immediately by files 002.jpg through 0050.jpg. Can anyone please tell me what I did wrong in my code? Thank you all very much in advance! Here's my code: #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> bool magictag(int *); int