View Single Post
  #1 (permalink)  
Old 12-15-2010, 06:14 AM
Jim
Guest
 
Posts: n/a
Default File structure question

(First off let me apologise for the somewhat rambling nature of this
post)

I currently do a lot of work in THEOS MultiUser BASIC. That has one type
of file that I find incredibly useful - ISAM files. The format for one
is:

Key:value1,value2,value3,...value n

You create one thusly:

CREATE JIM.DATA (INDEXED KEYLEN 10 RECLEN 200

which would create an ISAM file called 'JIM.DATA' with a key length of
50 chars and a record length of 200 chars.

Writing to one is simply a case of opening it and writing like this:

WRITE #1,"KEY":"VALUE1","VALUE2","VALUE3"

and reading from it would be a case of:

READ #1,"KEY":VAR1$,VAR2$,VAR3$ (doesn't have to be strings)

you can also do things like:

READNEXT #1,KEY$:VAR1$,VAR2$,VAR3$

which would read the next key in the file (based on current position)


I'd like to move a lot of this stuff over to an Objective-C environment
(probably on a Mac, so with the Cocoa libraries) but my question is
simply: is there an easy-ish way to duplicate the ISAM file behaviour
using Obj-C and the Cocoa libraries?

Many thanks.

Jim
--
"Sir Alan [...] made his fortune in the early Eighties selling computers
to parents who didn't love their children enough to get them a C64."
- The Daily Mash
Facetime ID:jim@magrathea.plus.com
Reply With Quote