W3cubDocs

/Haskell 7

System.Posix.Temp

Copyright (c) Volker Stolz <[email protected]> Deian Stefan <[email protected]>
License BSD-style (see the file libraries/base/LICENSE)
Maintainer [email protected], [email protected], [email protected]
Stability provisional
Portability non-portable (requires POSIX)
Safe Haskell Safe
Language Haskell2010

Description

POSIX temporary file and directory creation functions.

mkstemp :: String -> IO (FilePath, Handle) Source

Make a unique filename and open it for reading/writing. The returned FilePath is the (possibly relative) path of the created file, which is padded with 6 random characters. The argument is the desired prefix of the filepath of the temporary file to be created.

If you aren't using GHC or Hugs then this function simply wraps mktemp and so shouldn't be considered safe.

mkstemps :: String -> String -> IO (FilePath, Handle) Source

Make a unique filename with a given prefix and suffix and open it for reading/writing. The returned FilePath is the (possibly relative) path of the created file, which contains 6 random characters in between the prefix and suffix. The first argument is the desired prefix of the filepath of the temporary file to be created. The second argument is the suffix of the temporary file to be created.

If you are using as system that doesn't support the mkstemps glibc function (supported in glibc > 2.11) then this function simply throws an error.

mkdtemp :: String -> IO FilePath Source

Make a unique directory. The returned FilePath is the path of the created directory, which is padded with 6 random characters. The argument is the desired prefix of the filepath of the temporary directory to be created.

If you are using as system that doesn't support the mkdtemp glibc function (supported in glibc > 2.1.91) then this function uses mktemp and so shouldn't be considered safe.

© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).
https://downloads.haskell.org/~ghc/7.10.3/docs/html/libraries/unix-2.7.1.0/System-Posix-Temp.html