unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* mkstemp strange behavior
@ 2005-08-10 17:25 José Roberto B. de A. Monteiro
  2005-08-10 17:54 ` Alan Grover
  0 siblings, 1 reply; 7+ messages in thread
From: José Roberto B. de A. Monteiro @ 2005-08-10 17:25 UTC (permalink / raw)


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
string:

#!/usr/bin/guile \
-s
!#

(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")
(test)
(format #t "Second call...\n")
(test)
			  
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
call...

Some help!?

Regards
Betoes


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-12 20:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-10 17:25 mkstemp strange behavior José Roberto B. de A. Monteiro
2005-08-10 17:54 ` Alan Grover
2005-08-10 18:18   ` R. Mattes
2005-08-11 19:37     ` Marius Vollmer
2005-08-10 19:24   ` José Roberto B. de A. Monteiro
2005-08-12  8:03     ` Tomas Zerolo
2005-08-12 20:47       ` José Roberto B. de A. Monteiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).