Looks like your getting a standard Windows error code 5 ( ERROR_ACCESS_DENIED ). Check your file permissions. As well, you're opening the file in write/create mode (5) and yet your trying to read a line, does that work ? To quote from the manual ...

Note
These (mode) values are cumulative. So if you want to open a file for write access, and create it if it does not yet exist, you should specify 5. Notice however that a file can not be opened for read and write access at the same time

Anybody ???

Shawn.