[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mkstemp strange behavior

From: José Roberto B . de A . Monteiro
Subject: mkstemp strange behavior
Date: Wed, 10 Aug 2005 14:25:26 -0300
User-agent: Mutt/1.5.9i

Hello all!

I was trying to use mkstemp! in my program, instead of tmpnam, but I have no
success... I mkstemp! is getting me confused. It alters original string, so
we can easely have the name of temporary file.

But, with following code, I suposed it would work, but it is reusing an old

#!/usr/bin/guile \

(define (test)
  (let ((filename "/tmp/XXXXXX")
        (tmp #f))
    (format #t "before: filename=~A\n" filename)
    (set! tmp (mkstemp! filename))
    (format #t "after : filename=~A\n" filename)
    (close tmp)))
(format #t "First call...\n")
(format #t "Second call...\n")
And the result of this code is:

First call...
before: filename=/tmp/XXXXXX
after : filename=/tmp/HGLPtZ
Second call...
before: filename=/tmp/HGLPtZ
ERROR: In procedure mkstemp!:
ERROR: Invalid argument

I can not figure out why the string is not set to /tmp/XXXXXX in the second

Some help!?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]