From: ············@my-deja.com
Subject: Writing a structure to a file
Date:
Message-ID: <8kgabm$dle$1@nnrp1.deja.com>
Hello,
I am using Allegro 5.0.1 in Windows and I am attempting to write a
structure to a file using with-open-file (shown below is a sample of
code).
(with-open-file (filename "C:\\notification-log.txt"
:direction :input
:if-does-not-exist :create
:if-exists :append)
*** this is where my trouble exists ***
(format filename "~A" (event-data (cadr request-event-list))))
I have made several attempts using format, write-line, and
write-sequence but these all produce an error similar to:
Error: No methods applicable for generic function
#<STANDARD-GENERIC-FUNCTION STREAM-LINE-COLUMN> with args
(#<EXCL::CHARACTER-INPUT-FILE-STREAM
#p"C:\\db-notification-log.txt" pos 0 @ #x258e40a2>)
of classes (EXCL::CHARACTER-INPUT-FILE-STREAM)
This seems odd to me because I am able to use format stand alone to send
the structure to standard-out.
(format nil "~A" (event-data (cadr request-event-list)))
If anyone can give me some advice on how I can accomplish my goal I
would appreciate it.
Thanks
Keith
Sent via Deja.com http://www.deja.com/
Before you buy.
············@my-deja.com writes:
> (with-open-file (filename "C:\\notification-log.txt"
> :direction :input ; *** HERE ***
> :if-does-not-exist :create
> :if-exists :append)
> *** this is where my trouble exists ***
> (format filename "~A" (event-data (cadr request-event-list))))
I think that if you're writing to the stream, then it has to have
:direction of :output (or, of course, it could be an input/output stream
:io).
dave
From: ············@my-deja.com
Subject: Re: Writing a structure to a file
Date:
Message-ID: <8kgerb$gsd$1@nnrp1.deja.com>
In article <···············@department-of-alchemy.mit.edu>,
David Bakhash <·····@alum.mit.edu> wrote:
> ············@my-deja.com writes:
>
> > (with-open-file (filename "C:\\notification-log.txt"
> > :direction :input ; *** HERE ***
> > :if-does-not-exist :create
> > :if-exists :append)
> > *** this is where my trouble exists ***
> > (format filename "~A" (event-data (cadr request-event-list))))
>
> I think that if you're writing to the stream, then it has to have
> :direction of :output (or, of course, it could be an input/output
stream
> :io).
>
> dave
>
yes, thank-you.
:direction :input
solves all my worries if the day.
Keith
Sent via Deja.com http://www.deja.com/
Before you buy.
After taking a quick look, I'd recommend that you use:
:direction :output
instead of :input.
In article <············@nnrp1.deja.com>, ············@my-deja.com wrote:
> Hello,
>
> I am using Allegro 5.0.1 in Windows and I am attempting to write a
> structure to a file using with-open-file (shown below is a sample of
> code).
>
> (with-open-file (filename "C:\\notification-log.txt"
> :direction :input
> :if-does-not-exist :create
> :if-exists :append)
> *** this is where my trouble exists ***
> (format filename "~A" (event-data (cadr request-event-list))))
>
> I have made several attempts using format, write-line, and
> write-sequence but these all produce an error similar to:
> Error: No methods applicable for generic function
> #<STANDARD-GENERIC-FUNCTION STREAM-LINE-COLUMN> with args
> (#<EXCL::CHARACTER-INPUT-FILE-STREAM
> #p"C:\\db-notification-log.txt" pos 0 @ #x258e40a2>)
> of classes (EXCL::CHARACTER-INPUT-FILE-STREAM)
>
> This seems odd to me because I am able to use format stand alone to send
> the structure to standard-out.
> (format nil "~A" (event-data (cadr request-event-list)))
>
> If anyone can give me some advice on how I can accomplish my goal I
> would appreciate it.
>
> Thanks
> Keith
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
--
David Mittman, MS 264-767 ·······@jpl.nasa.gov
Jet Propulsion Laboratory Voice: 818-393-1091
4800 Oak Grove Drive Fax: 818-393-4426
Pasadena, California 91109-8099 Pager: 818-541-3015
Did you mean :direction :output
············@my-deja.com wrote:
>
> Hello,
>
> I am using Allegro 5.0.1 in Windows and I am attempting to write a
> structure to a file using with-open-file (shown below is a sample of
> code).
>
> (with-open-file (filename "C:\\notification-log.txt"
> :direction :input
> :if-does-not-exist :create
> :if-exists :append)
> *** this is where my trouble exists ***
> (format filename "~A" (event-data (cadr request-event-list))))
>
> I have made several attempts using format, write-line, and
> write-sequence but these all produce an error similar to:
> Error: No methods applicable for generic function
> #<STANDARD-GENERIC-FUNCTION STREAM-LINE-COLUMN> with args
> (#<EXCL::CHARACTER-INPUT-FILE-STREAM
> #p"C:\\db-notification-log.txt" pos 0 @ #x258e40a2>)
> of classes (EXCL::CHARACTER-INPUT-FILE-STREAM)
>
> This seems odd to me because I am able to use format stand alone to send
> the structure to standard-out.
> (format nil "~A" (event-data (cadr request-event-list)))
>
> If anyone can give me some advice on how I can accomplish my goal I
> would appreciate it.
>
> Thanks
> Keith
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.