0

When I try to run the staff implementation as per the given command ~cs50/pset4/resize it gives me a usage prompt. When I then enter command line arguments like ./resize 4 small.bmp large.bmp I get a 'No such file or directory' error. When I tried ~cs50/pset4/resize 4 small.bmp large.bmp I got a 'Could not open small.bmp' error

I manually checked the pset4 folder in the cs50 directory and there is no image stored there that can be used as an input. So I don't understand how the staff implementation can run without inputting an image. Am I doing this wrong?

1

Simply put, you have to give the correct location for the input file. If you are in the same directory as small.bmp then the command ~cs50/pset4/resize 4 small.bmp large.bmp will work. But let's say that you are in the directory ~/Dropbox/pset4 and small.bmp is in ~/Dropbox/pset4/bmp. In that case, you could run ~cs50/pset4/resize 4 bmp/small.bmp large.bmp You could also run ~cs50/pset4/resize 4 ~/Dropbox/pset4/bmp/small.bmp large.bmp Both would leave large.bmp in the current directory though.

The bottom line is that you need to give either the relative path and file name or the absolute path and file name for the input file. You also need to do the same to tell the program where to put the output file.

Finally, while hardcoding a file location will work, it is generally a bad practice, unless there's a specific reason for doing so.

Please accept whichever answer you think is best so that this question is taken out of the unanswered question pool. Let's keep up on forum maintenance. ;-)

0

I would imagine that's because the system will by default be looking for small.bmp in the same location as resize, unless otherwise specified.

If you have write access to the folder ~cs50/pset4, copy small.bmp across there. Otherwise, create a new folder in your Dropbox or whatever, copy both resize and small.bmp in there and that should allow you to run the program.

1
  • I do not have write access to the cs50 folder. If I have to run the staff's implementation, don't I need to have everything in the cs50 folder? So if I create a new folder in my Dropbox with resize and small.bmp, I still won't be able to run the staff's implementation right? Jun 10 '15 at 17:12
0

Try

/home/cs50/pset4/resize 4 small.bmp new_file_name.bmp

I had this problem as well, the solution was to explicitly name the directories. I don't know if this was just short hand done by the cs50 team or some idiosyncrasy I've yet to grasp, but my solution works.

1
  • and if you're having problems getting to your home directory where the cs50 directory lives, go to your terminal and type "cd", followed by "cd .." Jun 10 '15 at 21:04

You must log in to answer this question.

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