In theory, there looks like there should be nothing wrong with this code. Try (i) printing out the name of the file before you try to open it and (ii) printing the value of errno when it fails (there...