0

I'm attempting pset6 from the 2014 CS50 course. When compiling to check my code, I'm running into the issue:

server.c:205:60: error: format specifies type 'int' but the argument has type
  'size_t' (aka 'unsigned long') [-Werror,-Wformat]
            if (dprintf(cfd, "Content-Length: %i\r\n", length) < 0)
                                              ~~       ^~~~~~
                                              %zu

I am not using the CS50 appliance as it is easier to get ssh access at work from a digital ocean droplet. Mostly everything has been working so far with the exception of check50, which I do once I get home and I think everything is working properly.

I don't fully understand the error I'm receiving! I did not alter the referenced line of code, so I'm not sure what I can do to fix it.

Thanks!

1
  • SOLVED! In case this comes up in a future search, the wonderful people at the cs50 subreddit gave me a quick solution to the problem. You can find the information here: reddit.com/r/cs50/comments/3oqdgn/… The solution, specifically, is: dprintf(cfd, "Content-Length: %i\r\n", (int)length) Thanks yeahIProgram Commented Oct 14, 2015 at 19:49

1 Answer 1

1

SOLVED! In case this comes up in a future search, the wonderful people at the cs50 subreddit gave me a quick solution to the problem. You can find the information here: https://www.reddit.com/r/cs50/comments/3oqdgn/help_with_pset6_serverc_int_vs_size_t/ The solution, specifically, is:

dprintf(cfd, "Content-Length: %i\r\n", (int)length) 

Thanks yeahIProgram –

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .