> my output is now cannot open file
Well if you write
perror ( "Cannot open file" );
Then you get to find out more about why the file cannot be opened.
Guesses include
- it exists already and is read-only
- the directory is not writable
- something else already has the file open for writing (another stalled copy of the program?)

