Subj : File access - BAJA
To : Amcleod
From : Jim King
Date : Mon Apr 02 2001 11:17 pm
A>RE: File access - BAJA
A>BY: Jim King to ALL on Mon Apr 02 2001 06:12 pm
A> > Would someone be willing to write and explain a simple (short) program
A> > that reads from and writes to a file in Baja?
A> >
A> > Use as many of the file accessing routines found in Baja.
A> >
A> > From Baja Docs:
A> >
A> > FOPEN <int_var> <#> <"str" or str_var> FILE_IO.INC
A> > args: handle access path_and_filename
A> >
A> > FREAD <int_var> <any_var> [int_var or #]
A> > args: handle dest length
A> >
A> > FCLOSE <int_var>
A> > args: handle
A>Essentially you have it covered, except: I'd recommend first a program that
A>opened the file, WROTE some data and then closed it. You decide what goes
A>into the file, what the format is, etc, etc, and you should have a pretty good
A>idea what to expect in that file when the program has executed.
Exactly, the module would be reading from a structured file (ie a
config file) to write to another structured file (a batch file)
In addition to writing to xtrn.cnf (a file of undetermined structure
:-)
A>THEN your SECOND program essentially does the opposite. Open the same file,
A>read back the data and display it to confirm that you i) wrote it correctly;
A>ii) read it back as expected.
A>Do you understand the arguments to the commands listed above? ("handle",
A>"access", etc) Or do you need someone to run through them with you first?
I have all the Baja Docs printed out however as it was in the two
years of Latin class I find I learn fastest with examples.
I have the basic premise worked out (in my head) and now I am trying
to translate it into Bajaese. (and in the process learn about
programming)
I'm not saying that Baja is the simplest language, just the one with
the most programmers I know.
Enough blather...
PG's examples are helpful, but as I said writing to xtrn.cnf can be
wreckless if I'm not careful. So I need more info on set_pos
It occurred to me to ask the man his self. I got back..
from \sbbs\cnfs.fmt
total_xtrns 2
... xtrn->sec 2
... xtrn->name 41
... xtrn->code 9
... xtrn->ar 41
... xtrn->run_ar 41
... xtrn->type 1
... xtrn->misc 4
... xtrn->event 1
... xtrn->cost 4
... xtrn->cmd 64
... xtrn->clean 64
... xtrn->path 64
... unused 16
Knowing all this... how would I translate ... say "xtrn->code 9" into a
fread statement? Using "%!\..\crtl\xtrn.cnf" as the source.
-
James King, Coldwater, Mi And that's JIM to you guys!
Tip of the day:
http://setiathome.berkeley.edu
---
� OLXWin 1.00b � Press "+" to see another tagline.
� Synchronet � Bits-N-Bytes One hell of a BBS 24.241.127.99