From: Francogrex on
On Jul 13, 6:25 pm, Barry Fishman <barry_fish...(a)acm.org> wrote:
> If you want tabs in the output you need to put them directly
> in the format spec, or indirectly by some means like:
>
>   (let ((fspec (format nil "~~{~~s~c~~}" #\tab)))
>    (with-open-file (stream "c:/tabout.txt" :direction :output)
>      (format stream fspec (list 1 2 3 4 5)))

This works fine. Thanks

From: Rob Warnock on
Francogrex <franco(a)grex.org> wrote:
+---------------
| Barry Fishman <barry_fish...(a)acm.org> wrote:
| > If you want tabs in the output you need to put them directly
| > in the format spec, or indirectly by some means like:
| >
| > (let ((fspec (format nil "~~{~~s~c~~}" #\tab)))
| > (with-open-file (stream "c:/tabout.txt" :direction :output)
| > (format stream fspec (list 1 2 3 4 5)))
|
| This works fine. Thanks
+---------------

Though that will leave a "tangling" tab at the end of each line,
and provide no newline at the ends. You might prefer this FSPEC:

(let ((fspec (format nil "~~{~~s~~^~c~~}~~%" #\tab)))
(with-open-file (stream "c:/tabout.txt" :direction :output)
(format stream fspec (list 1 2 3 4 5))))


-Rob

-----
Rob Warnock <rpw3(a)rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

From: Barry Fishman on
pjb(a)informatimago.com (Pascal J. Bourguignon) writes:
> All right, but to make it a portable program, you would have to do this:
>
> (when (ignore-errors (read-from-string "#\\tab"))
> (push :has-tab *features*))
>
> (let ((fspec #+has-tab (format nil "~~{~~s~c~~}" #\tab)
> #-has-tab "~11S "))
> (with-open-file (stream "c:/tabout.txt" :direction :output)
> (format stream fspec (list 1 2 3 4 5))))

Do portable programs accept file names in the form "c:/tabout.txt"?

--
Barry Fishman
From: Pascal J. Bourguignon on
Barry Fishman <barry_fishman(a)acm.org> writes:

> pjb(a)informatimago.com (Pascal J. Bourguignon) writes:
>> All right, but to make it a portable program, you would have to do this:
>>
>> (when (ignore-errors (read-from-string "#\\tab"))
>> (push :has-tab *features*))
>>
>> (let ((fspec #+has-tab (format nil "~~{~~s~c~~}" #\tab)
>> #-has-tab "~11S "))
>> (with-open-file (stream "c:/tabout.txt" :direction :output)
>> (format stream fspec (list 1 2 3 4 5))))
>
> Do portable programs accept file names in the form "c:/tabout.txt"?

This is irrelevant. You may substitute *my-file-pathname* instead.

--
__Pascal Bourguignon__ http://www.informatimago.com/