I've been stuck with the pset3 for a long time now and can't figure out why my code isn't working; it compiles fine but doesn't produce an image except for the factor
1. Could someone point me in the right direction?
Thanks a ton in advance!
CS50 Stack Exchange is a question and answer site for students of Harvard University's CS50. It only takes a minute to sign up.Sign up to join this community
There are some issues here, but let's attack the main problem. You can sort out anything else that remains, depending on how you recode the program.
Think about what the code does. Simply put, it reads in a pixel (RGBTRIPLE) and writes it out immediately. It does nothing to scale up, i.e., write out each pixel n times. It will ONLY write each pixel ONCE. There's also no code to duplicate each LINE of pixels n times, to scale vertically.
In short, while the code will work with a scaling factor of 1, there's no code to support scaling up to anything greater than 1. Time to add code to complete the assignment.
Also, there's an error in the header data when n>1 that'll give you a clue to another problem. ;-)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)