guile-user
[Top][All Lists]
Advanced

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

Re: can `call-with-output-file' specify access mode?


From: nalaginrut
Subject: Re: can `call-with-output-file' specify access mode?
Date: Tue, 30 Oct 2012 11:11:20 +0800

On Mon, 2012-10-29 at 15:26 -0400, Kejia柯嘉 wrote:
> for example, `append' mode string. now I just use `open-file' to
> specify the append operation.
> 

Do you need "a" mode in the 'open-file' while you call
'call-with-output-file'?
You may use fcntl to change it to O_APPEND in the thunk(I mean the proc)
for that.
----------------code---------------
(fcntl (port->fdes your_port) F_SETFL O_APPEND)
-----------------end---------------

And I believe 'call-with-output-file' is implemented with
'open-output-file' which has the same semantic. 

> and, I use `display' procedure to output a big string to a file. is
> that a standard way? should I use string port for this purpose?
> 

It's OK to output a big string to a file. And you may use "format"
either, and 'write'. It's flexible to do that, it's up to you.
But my suggestion is, temporarily avoid use 'format' to do that, since
our 'format' implementation is not so efficient at present, you may
checkout this:
http://lists.gnu.org/archive/html/bug-guile/2012-08/msg00017.html

And we do have couple of solutions for the 'format', but haven't done it
yet.

A very large string is fine to output with 'display', to my experience.

> ----------
> Kejia
> 
> 
> ☵☯☲
> 





reply via email to

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