Questions tagged [pset4]

The standard edition of Problem Set 4 will move beyond C programming language basics, testing your knowledge of pointers, memory management, file i/o and structs.

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

recover compiles and runs but no jpeg is saved

I save the name of the picture in picname and open it in img and do the rest of the copying from memory card on img , the program compiles and runs fine but no image is saved in the current directory....
1
vote
1answer
148 views

pset4 recover - 16 images recovered with Invalid or Unsupported Image Format

I'm really confused. I reviewed all similar problems, but did find my case. It seems like jpeg start bytes are detected, but wrong data inserts to the output file. Please advise! 24-Oct-2016: The ...
0
votes
1answer
41 views

I don't know what I'm doing wrong Pset4 filter "edges"

I can't get edges to work I would really like some hints to what's wrong with my code. // Detect edges void edges(int height, int width, RGBTRIPLE image[height][width]) { //copying original image ...
0
votes
2answers
133 views

pset4 Resize - black bars of padding?(not sure how to get rid of them)

First time on this so be gentle. I have been at a standstill on this for hours. Below is my code and I can't seem to find out why these black bars(padding)show up. Any help? #include <stdio.h> #...
0
votes
1answer
153 views

recover pset4 cs50 not creating any jpg

I've been checking this code but I don't see why my program isn't creating any jpg. Could you help me to guess why? The program is compiling without errors. Thank you include #include typedef ...
0
votes
1answer
32 views

lab 4 is not passing check50, but the volume is changing by the factor when we listen to the audio

// Modifies the volume of an audio file #include <stdint.h> #include <stdio.h> #include <stdlib.h> // Number of bytes in .wav header const int HEADER_SIZE = 44; int main(int argc, ...
0
votes
1answer
104 views

Images are not producing

This is my code. It is compiling and executing but not producing any images
0
votes
2answers
442 views

Pset4 , edge , I dont understand what is wrong ,

It seems it is finding edges, When I run check50 it is giving me the errors below : :) edges correctly filters middle pixel Log testing with sample 3x3 image first row: (0, 10, 25), (0, 10, 30), (...
0
votes
1answer
300 views

pset4 recover: Code works 3/4 times. Sometimes gives segmentation fault. Doesn't pass check50

I'm having trouble figuring out what is going on. 3/4 times I run ./recover, it produces all 16 pictures correctly. Other times, I get a segmentation fault. When I run valgrind it gives me two "Use of ...
1
vote
1answer
467 views

Looking for clarification on PSET4 Resize - "Rewrite" method

Can I request for some help on my resize.c pset? I'm trying to do the "rewrite" method as per the pset's walkthrough. The pseudocode is as follows: 1 for each row 2 for each pixel 3 write ...
0
votes
1answer
102 views

I'm getting a Segmentation Fault when running recover.c

Seems like others also had the same problem of a Segmentation Fault when trying to do solve this, but I'm not going to look at those. I already liked at another person's code while I was stuck trying ...
0
votes
1answer
158 views

PSET4 Recover: Not sure why my code is not working

I've reviewed my code and I think it should work, but only the first 512 bytes are being written, not sure why. #include<stdio.h> #include<stdlib.h> #include<stdint.h> typedef ...
0
votes
1answer
127 views

Why does my output image look like this for pset4 resize?

Please see code below, I know my fseek is incorrect, as im offseting the size of RGBTRIPLE whereas I want to offset the size of the buffer. /** * copy.c * * Computer Science 50 * Problem Set ...
0
votes
2answers
255 views

How do I use fread inside a condition

I watched the short for the set and its at the point where Zamyla explains that its useful to use read inside a condition to check for elf, she uses the example of if(read(&buff, sizeof(DOG), 2, ...
0
votes
1answer
109 views

Pset4 resize.c outputting giant block of pixels

Firstly I apologize because there are many posts asking similar questions, but I've read over all that I could find, and it appears to me that my logic should be correct. This leads me to believe ...
0
votes
1answer
128 views

Recover works but doesnt pass the check50... any ideas?

The code recovers the images but it doesn't pass the check and I can't figured out why yet... any ideas? Thank you! int main(void) { //declare a buffer array typedef uint8_t BYTE; BYTE ...
0
votes
1answer
263 views

pset 4 resize Image correct but size is off

Hello I am working on pset4 the resize part. My images look correct but they are a few bytes larger than the staffs is. I use peek to check the headers and they match the staffs exactly. The larger ...
0
votes
1answer
111 views

jpegs do not exists on running recover.c

i have made a program to recover the jpegs i.e. resize.c . The code is : http://pastebin.com/B0XkP9i9 the check 50 results: check50 2016.recover recover.c :) recover.c exists :) recover.c compiles :) ...
0
votes
1answer
240 views

pset4 increment pointer of type RGBTRIPLE by BYTE

In pset4, resizing an image, I decided to try out pointers and memory allocation to learn more about it, but I've run into an issue with my approach... I've created a pointer and allocated memory for ...
0
votes
1answer
199 views

PSET 4 Recover.c file size limit exceeded and segmentation fault

This is my code for PSET4. Can anyone explain why it is not working? I have tried debugging forever. But I get various combinations of file limit exceeded and segmentation faults that just don't go ...
0
votes
1answer
125 views

Segmentation fault in blur filter

This is my code for the blur filter in the pset 4. First I used the average for the corner pixels, then I used a loop for the average of the first and last row and columns and then a nested loop for ...
0
votes
1answer
51 views

Pset4 Speller (valgrind)

// Unloads dictionary from memory, returning true if successful else false bool unload(void) { // TODO node *ptr; while (root) { int last_child; node *tmp; ptr =...
0
votes
1answer
223 views

pset4 recover.c segmentation fault fread/fwrite

I am trying to complete recover.c for pset4, but I am having major trouble debugging. I get a segmentation fault after the first fwrite step has occured, and it creates the fault at the fread step at ...
0
votes
1answer
78 views

I am not able to submit my pset4

I not able to submit my pset4. When I try to upload my pset4 the uploading takes forever. Also I didn't receive any mail from the cs50 bot informing that my pset4 has been submitted. Please can ...
1
vote
1answer
64 views

PSET4 — Filter (more) — Edges Error

I'm currently working through the filter problem, and I'm not sure why it's not working on the pixels on the edge (it also seems to only be incorrect on the B value in RGB). This is the message I'm ...
2
votes
1answer
187 views

Header Problem in Resize

There is some serious flaw in the header file code of my program since all the variables that was required to be modified is showing error while running the peek program (as shown in in the screenshot ...
0
votes
1answer
27 views

Pset4 recover 000.jpg 001.jpg 049.jpg are not found

PLEASE I am dying: I am searching for hours for the problem, but I can't find it. It compiles. At least 000. and 001. should be found but I get these results and I am full of remorse. Where could be ...
0
votes
1answer
259 views

pset4 whodunit how to submit

per the instruction of whodunit, "When submitting this problem, you’ll be asked whodunit!". However, when i submit, it does not ask me what is the whodunit. even though check50 shows all green but i ...
0
votes
1answer
154 views

Struggling with recover.c

Its getting compiled hence syntactically correct. But after execution it had just made 1 new jpg file and too corrupted. Could you please help me out here. I have used 508 instead of 512 ...
0
votes
1answer
315 views

recover not working pset4 cs50. Doesn't show images properly

I've been checking lots of answers to people with a similar problem. But I don't get this to work yet. My code recovers all the images, but the last image is empty. I've read answers and check the ...
0
votes
1answer
583 views

Pset4 recover help

int counter = 0; FILE* inptr = fopen("card.raw", "r"); BYTE compare[512]; fread(&compare, 512, 1, inptr); while (!feof(inptr)) { if ((compare[0] == 0xff) && (compare[1] == 0xd8) &&...
0
votes
1answer
72 views

PSET4, RECOVER: Segmentation Fault

I have been trying to solve RECOVER from PSET4 and I keep getting a segmentation fault. Any ideas on why this happens? #include <stdio.h> #include <stdlib.h> #include <stdint.h> ...
0
votes
1answer
85 views

Pset4, Resize: Cant resize vertically. Padding gets messed up.

I'm new here. I've figured out how to resize horizontally, but can't figure out how to do it vertically. here's the code. /** * Copies a BMP piece by piece, resized. */ #include <stdio.h> #...
0
votes
2answers
149 views

Pset 4 Filter Reflect less

I can't find why it doesn't work. That's the error message: index 600 out of bounds for type 'RGBTRIPLE [width] And I think it makes half reflection and half stays the same... That's my code: // ...
0
votes
2answers
25 views

Blur problem (Less)

I can't catch the error in my code, I think that I 'm using the right Algorithm and approach. // creating a copy to apply blur on it RGBTRIPLE copy[height][width]; // initializing avaerages' ...
0
votes
1answer
257 views

Pset4 Recover - only one corrupted picture is recovered!

I'm not sure what I'm doing wrong. I tried to follow the walkthrough. My code is below. Any help will be appreciated. typedef uint8_t BYTE; typedef struct { BYTE first; BYTE second; ...
0
votes
1answer
184 views

Pset4 recover.c I'm able to recover all images. But Check50 is not passing

:) recover.c exists :) recover.c compiles :) handles lack of forensic image :) recovers 000.jpg correctly :( recovers middle files correctly :( recovers last file correctly I am able to see all 50 ...
0
votes
1answer
66 views

cs50 pset4 speller trie word too long "index 46 out of bounds for type 'char [46]'". Isn't that handled by the code already written?

My code is giving all the right answers (lalaland.txt), but valgrind says: ==9947== dictionary.c:69:25: runtime error: index 46 out of bounds for type 'char [46]' (and I printf the problem - too ...
0
votes
1answer
50 views

Why can't I assign the return value of a fwrite() function to another variable? Infinite loop

In 'recover' I wanted to jump out of my while loop if the fwrite() function of the last photo (of the file) returns a value < 512 (indicating that the last photo or end of file is reached). I ...
0
votes
1answer
34 views

Pset4Ffilter - Starting Off

I'm doing the pset4 filter (less comfortable),but I just don't know where to start. Can someone pleases give me some starting off tips?
0
votes
1answer
100 views

code is free(): invalid pointer and Aborted, and I don't understand why

at first it worked. But i make style and add more coment and it was broken. It makes all images but in the end: free(): invalid pointer Aborted and i don't understand why. I rewrite code and all work....
0
votes
1answer
27 views

PSET4 Sepia If Statements

Hi can i ask why the if statements does not execute in this code? I tried running the program and saw that the if statements were not executed. void sepia(int height, int width, RGBTRIPLE image[...
0
votes
1answer
62 views

What is wrong with my filter blur?

Been stuck on the blurring part for ages... I've ran out of ideas and motivation to debug at this point after spending an eternity cutting down my spaghetti codes to pappardelle. Any help/hint/...
1
vote
1answer
43 views

CS50 - PSET 4 - Filter - Edges

//Pixel buffer RGBTRIPLE pixelBuffer[height][width]; //Iterates on every pixel and calculates Gx and Gy for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++)...
0
votes
1answer
23 views

cs50 Pset4 filter(more) blur

void add(RGBTRIPLE* a, RGBTRIPLE* b){ a->rgbtRed += b->rgbtRed; a->rgbtGreen += b->rgbtGreen; a->rgbtBlue += b->rgbtBlue; } // Blur image void blur(int height, int width,...
0
votes
1answer
436 views

Debug50 Running through breakpoints

I am trying to use debug50 for PSET 4 (Recover). However, when I set the breakpoints the debugger runs through them and do not pause. Only when I set the breakpoint at the if statement shown in the ...
0
votes
2answers
155 views

Q: PSETt#4 - Filter (more) - Edges

I'm stuck with the problem pset4 edges. The checks for the middle pixels work. But not the corner's pixels. :( edges correctly filters pixel in corner expected "76 117 255\n", not "76 117 66\n" It ...
0
votes
1answer
60 views

CS50 PSET4 Edge calculates correct values on all tests unless the correct value is 255

I am having problems with CS50 PSet 4 - Edge. The method passes the middle pixel test (which has no value of 255 on any channel) but on any other test all the values in each channel are correct ...
0
votes
1answer
65 views

PSET 4 Code fails two checks

Stuck on this problem for days and I can't figure out why my code is failing, I'll admit I'm struggling to really understand what my code is doing, like how the filename variable works. But I've ...
0
votes
1answer
15 views

filter less: Reflection : image is reflected correctly but does not pass check50

void reflect (int height, int width, RGBTRIPLE image[height][width]) { RGBTRIPLE invert[height][width]; for (int i=0; i<height; i++) { for (int j=width,s=0; j>=0; j-...

1
2 3 4 5
35