Hot answers tagged

2 votes
Accepted

PSet4, resize.c. Stuck on solution using malloc (recopy)

Your code is fixable with 3 adjustments. The biggest problem is that your "tracker variable" (t) for your buffer gets reset to 0 for every pixel of the infile, rather than for every line. In other ...
Omid's user avatar
  • 36
1 vote

CS50 pset4 recover: buffer type and fseek questions

an int is 4 bytes an unsigned char is 1 byte so buffer[3] in char is the 4th byte but in int it is the 13-16 bytes. so when using int you are not actually checking the first 4 bytes, but the first 16.
masterseeker's user avatar
1 vote
Accepted

Data Type to be used in Buffer for Recover (PSET4)

You're trying to put strings into byte/unsigned char/char arrays. Quotation marks denote a string. Since the values you're trying to put in are in fact, numbers, you must not use quotation marks. ...
aquablitz11's user avatar
1 vote
Accepted

pset4 malloc() approach. Help with size of buffer

It has nothing to do with the malloc call itself. The problem lies in what you think you are checking. Look at the following: RGBTRIPLE* row = ... int sizeRow = sizeof(row); row is declared as a ...
Cliff B's user avatar
  • 68.1k
1 vote
Accepted

pset4 "resize" scanline vertical copies

I see two issues immediately. First, you have a problem with your output padding. Hint: compare the calculation of your input padding to your output padding. Second, your program depends on being ...
Cliff B's user avatar
  • 68.1k
1 vote

Command line argument - buffer over read

The problem is not with the argv only but with every input from the user, that is not checked. For example say you define a string that will hold 10 characters (let's call it buffer). Then you ask the ...
ChrisG's user avatar
  • 7,366

Only top scored, non community-wiki answers of a minimum length are eligible