0

I'm working on unit testing a project and want to check that something fails when given a file that cannot be written to.

On Unix, I know there are a number of handy files that can be used to check different cases, e.g. /dev/full

Is there some file I can use for windows systems that will always fail when written to?

2
  • For my use case, it seems like the empty path does the case, but I'm still interested in what other ways this can be done.
    – 4e554c4c
    Oct 2, 2018 at 22:29
  • Would just creating any read-only file be sufficient? (Didn't know about /dev/full, interesting!)
    – Xen2050
    Oct 2, 2018 at 23:33

1 Answer 1

1

Load up a command shell and do:

attrib C:\path\to\file\here.txt +R

to mark a file readonly.

For general info (copied from attrib help): + Sets an attribute. - Clears an attribute. R Read-only file attribute. A Archive file attribute. S System file attribute. H Hidden file attribute.

You must log in to answer this question.

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