[net.micro.mac] Writing random bytes to resource fork

davidl@orca.UUCP (David Levine) (03/12/85)

I've been looking for a database.  This weekend I found that 1st Base version
2.0 does everything I need except for one thing: it won't read an ASCII
file into a database.  (If someone knows a way to make 1st Base read anything 
other than a file prepared by 1st Base, let me know!)

So, thought I, why don't I take a look at the database file and see if I can
patch together something 1st Base will accept as one of its own?  I thought it
should be pretty easy to write a program that would read my text file (from
MacTerminal) and produce a 1st Base formatted file.

I examined a 1st Base data file with Fedit to find out its structure.  It 
turns out that the data fork of a 1st Base data file is just a series of 
fields, each padded with spaces to its full length.  No delimiters of any sort 
are used, it just counts bytes.  The resource fork contains the description of 
the fields.

The problem is that the resource fork is in some internal 1st Base format.
It's quite straightforward (something like <byte indicating length of field>
<the letter A> <sixteen bytes indicating the field name> repeated for each
text field), but it isn't a resource, it's just data stored in the resource 
fork.  The difference means that it's not in a format the Resource Manager can 
deal with, so the Resource Editor and RMover just bomb out if you attempt to 
open the file.

My question: How do you write non-resource-formatted data to the resource fork
of a file?  At the moment, the only language I have is xlisp, but I can
probably find someone with a C compiler to write the simpleminded program it
would take to do it... if it's possible at all.  Inside Mac is no help
whatsoever.  (It must be possible, because 1st Base does it!)

Any other suggestions on how to make 1st Base eat an ASCII file would be
appreciated.  I'm considering writing a Unix program to write the file to
file.rsrc and file.data and downloading, but that would introduce a THIRD
computer (the original data is on a CP/M machine).

If it really can't be done, I may have to consider a different database.
Microsoft File will do it, but I don't like its user interface.  Mac Lion and
Helix are too expensive, and too complicated for the computer illiterates who
will have to use the system.  Any other suggestions?

David D. Levine  (...decvax!tektronix!orca!davidl)          [UUCP]
                 (orca!davidl.tektronix@csnet-relay.csnet)  [ARPA]

lsr@apple.UUCP (Larry Rosenstein) (03/24/85)

In article <orca.1394> davidl@orca.UUCP (David Levine) writes:
>
>My question: How do you write non-resource-formatted data to the resource fork
>of a file?  At the moment, the only language I have is xlisp, but I can
>probably find someone with a C compiler to write the simpleminded program it
>would take to do it... if it's possible at all.  Inside Mac is no help
>whatsoever.  (It must be possible, because 1st Base does it!)

You can access the resource fork of a file in the same manner as the data
fork by opening the file with the call PBOpenRF (in Pascal) or _OpenRF
(assembler).  This is documented in the File Manager Programmer's Guide.
-- 
Larry Rosenstein

UUCP:  {nsc, dual, voder, ios}!apple!lsr
CSNET: lsr@Apple.CSNET