<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 07 Jul 1998 12:32:03 +0100
From   : jgh@... (Jonathan Graham Harston)
Subject: [None]

Re: [BBC-Micro] XFER bug
Chris Johns <cmjohns@...> wrote:
> [snip] OPENOUT needs at least 16k to create the file, and if XFER [snip]
> I tried changing all OPENIN and OPENOUT statements in the program, but
> then when I tried to transfer files I got a "channel" message.  Do I
 
Try:  out%=OPENUP(file$):IFout%=0:out%=OPENOUT(file$)
 
> you could try the OSFILE of *SAVE filename 0 0 0 0 then OPENUP it...
 
No.... That would reserve 0 bytes for the opened file.
 
OPENOUT effectively does:
   IF NOT file_exists THEN
     *SAVE filename 0+4000  without transfering any data
   ENDIF
   OPENUP filename          but for output only
 
OPENUP opens an /existing/ file for /update/, ie input /and/ output, and
so therefore it has to exist.  It returns zero if file does not exist.
 
OPENIN opens an /existing/ file for /input/ only.
 
If you want to write to a file, and you know it's maximum likely size
beforehand, do something like:
 
    OSCLI "Save "+filename$+" 0+"+STR$~maxsize%
    out%=OPENOUT(filename$)
 
so, apply that to the above, and you'd get:
 
DEFFNopenup(file$,maxsize%)
  LOCAL A%
  A%=OPENUP(file$):IFA%:=A%
  OSCLI "Save "+file$+" 0+"+STR$~maxsize%
=OPENOUT(file$)
 
And you can use out%=FNopenup() to open a file, and creating one of a
defined size if it doesn't already exist.
 
[ This is my first post to the BBC Mailing List.  Has it got through? ]
 
--
J.G.Harston (JGH BBC PD Library) 70 Camm Street, Walkley, SHEFFIELD S6 3TR
BBC+Master / Z80+6502 / CoPro+Tubes / Econet+SJ / Devolution / Transport /
Planning / Highways    http://homepages.nildram.co.uk/~amilton/walkley.htm
jgh@...                  (( Anti-UCE address added by Arcade, not by me ))
               - + - * NTAUS#3 24th-26th July 1998 * - + -
                 At my place again - Contact for details
-- 
    ___  ___  ___  ___  ___  ___   | Free Internet E-mail and Anti-UCE News | 
|  /   \/   \/   \/   \/   \/   \  | +44 181 654 2212 also +44 181 655 4412 |
|    A    R    C    A    D    E    |   Croydon  UK  -  Fidonet#2:254/27.0   |
|     The Definitive Acorn BBS     | http://arcade.demon.co.uk  at weekends |


<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>