chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Platform-specific newline in a string?


From: felix winkelmann
Subject: Re: [Chicken-users] Platform-specific newline in a string?
Date: Fri, 4 Feb 2005 13:47:39 +0100

On Wed, 2 Feb 2005 15:11:30 -0800, Dan Webb <address@hidden> wrote:
> Hello,
> 
> Hello chicken users.  I just started using chicken a couple of weeks ago.
>  So far it's been great!
> 
> Here's my problem:
> 
> When I format a string like this:
> 
>   (sprintf "~A~%" text)
> 
> and then write the string to a file, it writes only a line-feed character
> to the file.  This is correct only on unix.  Is there any way to write a
> platform-specific newline to the string?
> 

Well, is this really what sprintf should do? The actual newline->CRLF
translation normally happens at the time text-files are actually
written. I'm not sure whether doing this "internally" is the right way
to do. Actually writing the result of the expression above *should*
result in CR/LF being written. Are you operning the destination
file in text-mode? Call open-output-file with an additional #:text
argument, like this:

(define p (open-output-file "filename" #:text))


cheers,
felix




reply via email to

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