Does anyone know of some code that test the results of these situations:

If someone tries to write to a file reader?
If someone tries to write to a random-access file that you opened only for reading?