Re: [BLACKBOX] How to concatenate ASCII files

From: Rene A. Krywult <"Rene>
Date: Thu, 26 Jul 2012 18:20:41 +0200

----boundary-LibPST-iamunique-1463846098_-_-
Content-type: text/plain

Rainer,

You don't need WinApi for so simple a task.

Have a look at "Help"->"Examples" in the BB menu.

There you'll find the documentation and source code for ObxAscii, ObxHello1 and ObxOpen1, which has all information you need.

F.i. you could start with ObxOpen1. The "Do" Command opens an existing file. In the File Open Dialogue you can select filetype "Text (.txt)". This reads an existing ASCII File and creates a new TextModels.Model.

Do this for all the files you wand to concatenate.

Then create a new TextModels.Model (see ObxHello1:

        VAR t: TextModels.Model; f: TextMappers.Formatter; v: TextViews.View;
        BEGIN
                t := TextModels.dir.New();

).

Next, append one TextModels.Model after the other to this new TextModels.Model with the following method:

t.Append(t1);

(where t1 is one of the Textmodels with the ASCII data).

Then show the textmodel in a view (see ObxHello1) and use the "File->Save As" menu to save it (choose the filetype you want).

To create a more automatized way of doing this, press F2 in BB (for the Help Contents), and then click "5 Texts", approximately in the middle of the window.

Hope that helps

Rene
-------- Original-Nachricht --------
> Datum: Thu, 26 Jul 2012 18:02:41 +0200
> Von: Rainer Neubauer <rainer.neubauer{([at]})nowhere.xy
> An: BLACKBOX{([at]})nowhere.xy
> Betreff: [BLACKBOX] How to concatenate ASCII files

> Hi all,
> in the near future I will have to programatically merge two or three ASCII
> files into one new file.
> Does anybody have a hint how to do this in a simple manner ?
> I had a look at the interface of module WinApi but could not find a
> procedure for this task.
> Reading the files line by line into a buffer and writing the contents to a
> new file seems to be a bit nasty.
>
> Best regards,
> Rainer
>
> ----
> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
> LISTSERV{([at]})nowhere.xy


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1463846098_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyN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U0lHTk9GRiBCTEFDS0JPWCIgdG9c
cGFyDQo+IExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSFxwYXINClxwYXINClxwYXINCi0tLS1ccGFy
DQpUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNL
Qk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PfX0AAAAAAAB4/H4AwPx+
----boundary-LibPST-iamunique-1463846098_-_---
Received on Thu Jul 26 2012 - 18:20:41 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:00 UTC