openFile package:system-fileio

Open a file in binary mode, and return an open Handle. The Handle should be closed with hClose when it is no longer needed. withFile is easier to use, because it will handle the Handle’s lifetime automatically. This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.