FAQ

On Fri, Oct 12, 2012 at 11:13 PM, Andrew Romanov wrote:

I used ioutil.Tempfile to create tempfile (os.File). Is there a way to
determine path to this tempfile?
func TempFile(dir, prefix string) (f *os.File, err error)
TempFile creates a new temporary file in the directory dir with a name
beginning with prefix, opens the file for reading and writing, and
returns the resulting *os.File. If dir is the empty string, TempFile
uses the default directory for temporary files (see os.TempDir).
Multiple programs calling TempFile simultaneously will not choose the
same file. *The caller can use f.Name() to find the name of the file.*It
is the caller's responsibility to remove the file when no longer needed.

--

Search Discussions

  • Andrew Romanov at Oct 12, 2012 at 5:27 pm
    I used ioutil.Tempfile to create tempfile (os.File). Is there a way to
    determine path to this tempfile?

    --
  • Minux at Oct 12, 2012 at 6:43 pm

    On Sat, Oct 13, 2012 at 12:38 AM, minux wrote:
    On Fri, Oct 12, 2012 at 11:13 PM, Andrew Romanov wrote:

    I used ioutil.Tempfile to create tempfile (os.File). Is there a way to
    determine path to this tempfile?
    func TempFile(dir, prefix string) (f *os.File, err error)
    TempFile creates a new temporary file in the directory dir with a name
    beginning with prefix, opens the file for reading and writing, and
    returns the resulting *os.File. If dir is the empty string, TempFile
    uses the default directory for temporary files (see os.TempDir).
    Multiple programs calling TempFile simultaneously will not choose the
    same file. *The caller can use f.Name() to find the name of the file.*It
    is the caller's responsibility to remove the file when no longer
    needed.
    On a second read of the bold text, I think we'd better use "path" instead
    of "name"
    in it. I made a CL 6649054 for it, let's see how it goes.

    --
  • Andrew Romanov at Oct 12, 2012 at 8:04 pm
    Thanks

    пятница, 12 октября 2012 г., 19:59:50 UTC+3 пользователь minux написал:

    On Sat, Oct 13, 2012 at 12:38 AM, minux <minu...@gmail.com <javascript:>>wrote:
    On Fri, Oct 12, 2012 at 11:13 PM, Andrew Romanov <judo...@gmail.com<javascript:>
    wrote:
    I used ioutil.Tempfile to create tempfile (os.File). Is there a way to
    determine path to this tempfile?
    func TempFile(dir, prefix string) (f *os.File, err error)
    TempFile creates a new temporary file in the directory dir with a name
    beginning with prefix, opens the file for reading and writing, and
    returns the resulting *os.File. If dir is the empty string, TempFile
    uses the default directory for temporary files (see os.TempDir).
    Multiple programs calling TempFile simultaneously will not choose the
    same file. *The caller can use f.Name() to find the name of the file.
    * It
    is the caller's responsibility to remove the file when no longer
    needed.
    On a second read of the bold text, I think we'd better use "path" instead
    of "name"
    in it. I made a CL 6649054 for it, let's see how it goes.
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 12, '12 at 4:44p
activeOct 12, '12 at 8:04p
posts4
users2
websitegolang.org

2 users in discussion

Minux: 2 posts Andrew Romanov: 2 posts

People

Translate

site design / logo © 2022 Grokbase