[comp.sys.m6809] I keep getting a device error

mdk@cbnews.ATT.COM (Shadow) (07/17/88)

Recently I tried to write a little basic09 program to spool print a letter
I was writing to my family.  It was a pretty simple program,  I passed it the
path to the file, and the number of copies I wanted printed and it would print
that number of copies.  However, it ran through the first iteration and
returned a device
not ready error.  I used a for loop to count the number of iterations and the 
shell command to list the file to the printer.  My question is this, can 
I use the close statement after printing the file without using an open
statement before I run the shell command.  Should I do something like:

for i = 1 to count
shell ("list " file ">" #printer)
close #printer
i=i + 1
next i

or do I need to have an open statement somewhere?  should it be before the
for loop, or should it be in the for loop?

In another area, I just got done taking a class in the UNIX(r) system shell.
(the Bourne shell).  It is pretty amazing what you can do with a shell that
is also a programming language.  I hope I can put some of this to use in
Basic09.  It's too bad we don't have something like that for OS9.

later,
Mike King
p.s. note the change in email address, we have gone to a newserver, so you
can email me there.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UUCP:..!att!cbnews!mdk1       | "What's the point in being grown-up |- The
Domain: mdk1@cbnews.ATT.COM   |  if you can't be childish at times?"| Doctor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

jimomura@lsuc.uucp (Jim Omura) (07/18/88)

In article <674@cbnews.ATT.COM> mdk@cbnews.ATT.COM (Shadow) writes:

>Recently I tried to write a little basic09 program to spool print a letter
>I was writing to my family.  It was a pretty simple program,  I passed it the
>path to the file, and the number of copies I wanted printed and it would print
>that number of copies.  However, it ran through the first iteration and
>returned a device
>not ready error.  I used a for loop to count the number of iterations and the 
>shell command to list the file to the printer.  My question is this, can 
>I use the close statement after printing the file without using an open
>statement before I run the shell command.  Should I do something like:
>
>for i = 1 to count
>shell ("list " file ">" #printer)
>close #printer
>i=i + 1
>next i

     The problem here is that you have tried to mix ASCII and binary
data.  The '#printer' is binary.  The best thing to do is to build
a character string properly in separate statements and then use it
in the shell() call.  Something like this:

cmd$ = "list " + file + " >/p"
shell(cmds$)

     That's off the top of my head, so there may be a mistake
in there, but I doubt it.

>In another area, I just got done taking a class in the UNIX(r) system shell.
>(the Bourne shell).  It is pretty amazing what you can do with a shell that
>is also a programming language.  I hope I can put some of this to use in
>Basic09.  It's too bad we don't have something like that for OS9.

     Well, yeah, but BASIC09 can make up for a lot of it.  But
like other areas of OS-9 6809, the thing I find disconcerting is
that as good as it is, it could stand improving, and Microware
seems to have become complacent about fixing bugs and such.
Frankly, I haven't used BASIC09 in a long time, having been
using C almost exclusively lately, but in the back of my mind
I vaguely remember finding a bug or two.


-- 
Jim Omura, 2A King George's Drive, Toronto, (416) 652-3880
ihnp4!utzoo!lsuc!jimomura
Byte Information eXchange: jimomura