Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #1568
| From | Roger Darlington <rogerarm@freeuk.com> |
|---|---|
| Newsgroups | comp.sys.acorn.programmer |
| Subject | Re: Merging three files together? |
| Date | 2012-04-02 09:33 +0100 |
| Organization | home |
| Message-ID | <19a7047a52.rogerarm@rogerarm.freeuk.com> (permalink) |
| References | <f08f977952.rogerarm@rogerarm.freeuk.com> <RG%dr.29350$4z7.11783@fx08.am4> |
On 1 Apr 2012, Steve Drain wrote:
> On 01/04/2012 13:42, Roger Darlington wrote:
>> I cant help thinking that there must be a simpler (and quicker) way of
>> merging 3 files together (within a program) than printing them to
>> screen and *spooling the result, but can find no 'merge' nor
>> 'concatenate' command in RO nor BASIC.
>>
>> SPOOL "<!Genus_Fam$Dir>.GeneraToFamilyInfo/htm"
>> PRINT "<!Genus_Fam$Dir>.Header"
>> PRINT "<!Genus_Fam$Dir>.Middle"
>> PRINT "<!Genus_Fam$Dir>.Footer"
>> *Spool
>>
>> Is there a simpler and quicker way (within BASIC).
> I am sure there are many ways to do this, but I suspect that they all
> need to load bytes from the source files and save them to the
> destination file. Here is one:
> new%=OPENOUT"GeneraToFamilyInfo/htm"
> PROCappend("Header",new%)
> PROCappend("Middle",new%)
> PROCappend("Footer",new%)
> CLOSE#new%
> END
> DEF PROCappend(add$,new%)
> LOCAL add%,not%
> add%=OPENINadd$
> REPEAT
> SYS"OS_GBPB",4,add%,END,256 TO ,,,not%
> SYS"OS_GBPB",2,new%,END,256-not%
> UNTIL not%
> CLOSE#add%
> ENDPROC
OK, thanks Steve.
Would a MERGE command or CONCATENATE command be a suitable candidate
for inclusion in your BASALT BASIC extension?
I seem to remember that even HP BASIC has a MERGE command, which will
merge files together.
> Note the use of END as a temporary buffer here and be careful that you
> do not change the routine to create any heap objects.
> Steve
--
Cheers
Roger
Off-road doesn't mean on-pavement.
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Merging three files together? Roger Darlington <rogerarm@freeuk.com> - 2012-04-01 13:42 +0100
Re: Merging three files together? Steve Drain <steve@kappa.me.uk> - 2012-04-01 17:48 +0100
Re: Merging three files together? Roger Darlington <rogerarm@freeuk.com> - 2012-04-02 09:33 +0100
Re: Merging three files together? Steve Drain <steve@kappa.me.uk> - 2012-04-02 11:56 +0100
Re: Merging three files together? Martin Bazley <martin.bazley@blueyonder.co.uk> - 2012-04-01 21:53 +0100
Re: Merging three files together? Roger Darlington <rogerarm@freeuk.com> - 2012-04-02 09:28 +0100
csiph-web