Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Don Cohen <don-sourceforge-xxzw <at> isis.cs3-inc.com>
Subject: Re: using pathnames containing wildcard characters
Newsgroups: gmane.lisp.clisp.general
Date: Friday 10th February 2012 20:20:35 UTC (over 5 years ago)
>So I see no way to use only ansi standard functions in clisp that can
  >distinguish between files with names containing CR's and LF's.
  Use custom:*pathname-encoding* as iso-8859-1 to work with strings.
That seems to work:
(with-open-file (f (concatenate 'string "/tmp/foo/"
     (convert-string-from-bytes #(65 13 66 10 67) CHARSET:ISO-8859-1))
    :direction :output))
NIL
then
(directory "/tmp/foo/*")
(#P"/tmp/foo/A^MB
C")

(I have to doctor the output to show you what appears on my screen.)
I didn't expect this to work and still don't understand why it does.
Why isn't this screwed up by the line terminator of the encoding?
I expected to get the same string as would have been read from a file
with the same bytes.  And that would have contained two "newline"
characters.

... Or so I thought -
 is this a bug or am I misunderstanding something important?

[102]> (with-open-file (f "/tmp/foo/content" :element-type
'(unsigned-byte 8))(loop while (print (read-byte f nil nil)) do t))

97 
13 
98 
10 
99 
NIL 
NIL
[103]> (with-open-file (f "/tmp/foo/content" :external-format
CHARSET:ISO-8859-1)(loop while (print (read-char f nil nil)) do t))

#\a 
#\Newline 
#\b 
#\c 
NIL 
NIL
[104]> 

Why didn't read-char show me the LF between the b and the c ?

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list
 
CD: 3ms