home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
c
/
cnews010.arc
/
CNEWS010.NWS
next >
Wrap
Text File
|
1988-08-15
|
55KB
|
1,139 lines
*------------------------------------------------------------------------*
| |
| C News - International C Newsletter, Compiler review, and |
| Tutorial. |
| |
*------------------------------------------------------------------------*
Volume 1, Number 10 9 Aug 1988
Editor | Editor's Corner: The Heap .................... 1
Barry Lynch | by Barry Lynch
|
Australian | Magazines: The Latest Crop ................... 2
Office: | by Barry Lynch
David Nugent |
| Book Reviews:
| QuickC Programming for the IBM ................ 4
| Reviewed by Barry Lynch
|
| Database Design .............................. 6
| by Arnie Cherdak
|
|
| Latest PD/Commercial Software Release ....... 19
|
| Article Submission Standards ................ 20
|
| Address's ................................. 21
|
| Index ...................................... 22
|
| Distribution Points ........................ 24
|
| User Response Form .......................... 25
|
|
|
| C News is an Electronic Journal published by the
| C BBS in Burke, VA Bi-Monthly. All rights are
| reserved, and all opinions expressed are of the
| authors and any damage sustained, either physically
| or financially via use of the routines in this
| journal are at the sole expense of the reader.
|
|
C News 1-10 Page 1 09 Aug 1988
================================================================
The Heap: Messages from the editor
================================================================
COMPUTER AIDED SOFTWARE ENGINEERING: Some thoughts ....
One area of programming that has always interested me, is
computer aided software engineering. I suppose what I am really
looking for is a software tool that helps me to automate the design,
coding and maintenance of my code/applications. This need is not
just for the PC world either, but the mini and mainframe world as
well. According to Datamation < an DP industry trade journal >, the
largest portion of a corporate MIS's group time and resources is
spent on maintaining software that is in production. This I can
agree on, from first hand experience.
I work for a large corporation that has annual sales over the
1 Billion mark. I work in an Engineering group that is responsible
designing, planning, projectizing, implementing, and maintaining
application software on minis and mainframes. The biggest problem
we face is: getting ALL of the functionality we request in a release,
and getting releases on a timely basis. Both of the problems are
directly related to the amount of work that is requested from the
Corporate MIS groups, and the nature of the business we are in.
Maintaining code is difficult, because of the myriad of
relationships the various modules in an application have with other
seemingly unrelated applications from other organizations. What is
needed is the ability to link all applications together, so that
changes in one that affect others, are reported on, and acted upon
at the same time. What generally happens is that one department
will make a change, that another affected department finds out about
when the application starts to crash. Thus necessitating emergency
coding by the affected group, thus delaying other projects in
progress etc.
I feel that the maintainability of code is so important that
a message area here at the C BBS - Number 22 - has been dedicated to
the subject. Other the coming months we hope to begin to understand
this field more. If you are interested or involved in this field
we would like to hear from you.
HONEYMOON..
As some of you know I will be getting married on the 27th of
August. Therefore, the C BBS will be on autopilot from the 27th
to the 10th of September. So if you leave me a message in that
time, do not get offended if I do not answer right away. I will
not be taking a PC with me or have access to one. So enjoy..
C News 1-10 Page 2 09 Jul 1988
================================================================
MAGAZINE Reviews: by Barry Lynch
================================================================
Magazine: Micro Cornucopia
Issue: No. 43 Sept - Oct 88
Publisher: Micro Cornucopia Inc
155 NW Hawthorne, Bend OR 97701
Subject: The Grass-Roots side of the PC World.
This issue of MC is dedicated to Database's. <Funny how this
issue of C News is covering the same subject!> One of the
things that I like about MC is it's approach - grass roots. MC
reminds me of what Byte used to be in the old days - informative,
and interesting. Quite frankly it is one of the few magazines
that I look forward to getting.
This issue contains:
- Accessing Dbase III records from Turbo Pascal.
- Building a C Database.
- Selecting a DBASE III Compatible Compiler
- Working with Paradox
- Build a Pascal Database.
- Designing Custom PC Cards.
For those of you that read the FidoNet C_Echo on a regular basis,
you will recognize the name of Scott Ladd. Scott writes the
"C'ing Clearly" column for MC, and does an excellent job of
keeping on top of the latest product releases, bug reports. This
issue of MC, he digs into ANSI C some.
Check out MC it is worth the yearly $18 fee for 6 issues. A tad
more expensive than the other magazines that are available. But
at least you get the feeling that the folks in Oregon like what
they are doing, and want to hear from us users.
C News 1-10 Page 3 09 Aug 1988
================================================================
MAGAZINE Reviews: by Barry Lynch
================================================================
Magazine: Microsoft Systems Journal
Issue: Vol 3. No 4. July 1988
Publisher: Microsoft Corporation
666 Third Avenue, New York, NY 10017
Subject: Articles associated with Microsoft Products.
This issue of MSS includes the following articles:
- DARWIN(tm) A Merrill Lynch Microsoft Windows Application
- Codeview(tm) for Windows.
- OS/2 Graphics Programming Interface.
- MSC MASM 5.1
- Color mixing principles and how color works in the raster
video model.
- Creating user defined controls for your own Windows
applications.
- SQL server brings DBMS to OS/2...
One of the problems with this publication is it's nasty habit
of taking Microsoft press releases and making articles out of
them. However, in among the chaff are a few grains of wheat
worth digging for. If you are serious about Windows or OS/2
programming, then MSS is a good resource tool to have.
C News 1-10 Page 4 09 Aug 1988
================================================================
MAGAZINE Reviews: By Barry Lynch
================================================================
Magazine: Dr. Dobb's Journal of Software Tools
Issue: #142 August 1988
Publisher: M&T Publishing Inc.
501 Galveston Drive
Redwood City, CA 94063
Subject: Articles associated with Programming.
First, the August issue of Dr. Dobb's is the annual C issue,
and is a must for all C programmers. Second, Dr. Dobb's is
still one of the best programming magazines around and occupies
a permanent home of my book shelf. <Labeled Magazine holders
and all..>
This issue of DDJ includes the following articles:
- C Compiler Review
- Find that Function
- Automatic Module Control in C
- A tool for Secret Key Crytography
- C Programming
and others.
This issue is a milestone of sorts, Allen Holub has been the
C Programming columnist for as long as I can remember. He has
stepped down from that position and been replaced by Al Stevens,
of 'Programming TSR's ' fame. It will be interesting to see
where Mr. Steven's takes the column. At any rate, DDJ is a
magazine that all programmers should read on a regular basis.
Some of the c source that has appeared in Dr. Dobb's has been
published in a series of Books by M&T Press. These are excellent
Intermediate-to-Advanced books and they are highly recommended.
C News 1-10 Page 5 09 Aug 1988
================================================================
BOOK REVIEW'S: By Barry Lynch
================================================================
Title: QuickC Programming for the IBM
Author: Carl Townsend
ISBN Number: 0-672-22622-7
Publisher: Howard W. Sams and Company
4300 West 62nd Street
Indianapolis, Indiana 46268
The last thing I needed - and my checkbook - was to buy
another computer book. For some reason If I do not buy at least
one book a month, I feel like I am not keeping up with this
crazy lunacy called the Computer Biz.. Not that I read all of the
books I own, but you known what I mean.
This is a book aimed at beginning users that use QuickC, hence
the title. But, Mr. Townsend does something that I wish other
authors would do as well. He provides a complete application in
source that he uses to explain the C language. The application is
a Mailing List program, that utilizes: Menus, a Database, and some
reporting capabilities. I always felt that learning by example
was one of the best ways to learn a subject. Mr. Townsend has done,
a good job of just that. If you have just bought QuickC, and have
thumbed through the manuals that Microsoft gave you. Go out and
get a copy of this book, and sit down and relax. This is an
excellent beginner's book.
C News 1-10 Page 6 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
I never paid a lot of attention to the subject of DATABASE.
It seemed that all I needed to know was how to run dBase II or
III -- it didn't seem to matter -- in order to satisfy my fairly
simple needs for putting some information together and then
searching, sorting, and examining as required. It wasn't until I
needed to do things with database files that were out of the
ordinary that I became aware that there was more to databases than
sequential files.
A proper discussion of the subject of database could fill
volumes and frequently has. In this article, I attempt merely to
point out some of the subject matter of database technology and to
focus on some of the more elemental aspects of programming for
database using C. Lest you think I'm going to go off the deep end
programming exotic and elaborate structures, be aware that I like
to do things as simply as I can and that I'll use a ready made
solution to the difficult part, a shareware package that takes care
of the files and indexes and all that stuff that will allow me to
focus more on the essence of the problem. This has an added
advantage in that it will make this article easier to write and
easier to read with less obscure detail. Let's get on with it.
Starting from the top...a database is a collection of
information, somehow related. A Database Management System is a
collection of programs that is used to search, sort, and examine
that database. Simple so far...but let's go on.
Much of the software technology centered around databases is
associated with ways in which information can be extracted from the
data. Structured Query Language or SQL is the latest and greatest
approach to programming searches of a large class of databases.
Those of you who have experienced dBase may remember the LOCATE
command that serves a similar purpose. Many database manager
software packages offer a selection of subroutines (for the
FORTRANners among us) that can be linked with users' programs to
search the database for the information of interest to the user.
More about searching and ways to do it, later.
A closely related subject to searching for information is
displaying the information resulting from the search. Although
it's considered by some to be a more mundane aspect of database
technology, the report probably commands more attention by the
database user and by the programmer than most other aspects. The
user interface, too, gets a lot of attention from the programmer
as it does in most other types of software.
C News 1-10 Page 7 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
These two aspects of database software are subjects that are too
big and important to be discussed briefly so I won't even begin.
I'll leave them for a future article.
At a lower level of detail, frequently hidden from the user,
is the fundamental structure of the database which includes the
organization of the data and the basic mechanisms used to enter
data into the database and to access that data. Since there is
generally more data in a database than can be held in primary
memory at one time and the data is generally required to be non-
volatile, the database consists of one or more files stored on
secondary memory (disk). Databases can be distributed far and
wide and accessed by way of complex data communications means.
However, this approach is not all that common and a database
located at a single location is the rule. Certainly, this is the
case for the small, PC-based databases we consider here.
Database files can have a wide range of forms. At one end of
the spectrum are complex files containing several segments that
make up the entire database including directories, headers, indexes,
and the data. These complex files can even be organized as trees
with pointers to adjacent records (i.e., tree nodes) in the tree
structure contained in each record. At the other end are simple,
sequential or "flat" files with uniform records. DBase III, for
example, is somewhere in the middle of the complexity spectrum with
a two-segment data file containing a description of the data records
at the front followed by uniform data records and a separate file
containing an index.
Depending upon the nature of the database management software,
there can be one or more files that make up the database. The
simplest case has the file composed of fixed size records, each
record composed of fixed size fields with the field being the
smallest element of data in the database. Indeed, if we consider
the database, itself as a file for our present purposes, the art
of database programming is really the art of programming searches
for the information contained in the data file. This is the subject
of the rest of this article.
DATABASE 101 -- Linear Searching
Let's continue with the simplest case. Suppose we had a list
(file) of names and addresses for a small community of about 200
families. Furthermore, suppose we wanted to have a list of families
living on Main Street. A very simple way to obtain that list is to
visually examine the list of all the families from beginning to end,
C News 1-10 Page 8 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
one family (record) at a time and to write down the family data
for each family satisfying the criterion that its street name was
Main Street. This is not a wonderfully sophisticated way to get
the information we want but it certainly is effective.
I just described a search method that could be programmed in
C or in some other programming language to search through a file
containing the family records to create a printed report. The
process I went through is as follows:
1) Open the file to the first record.
2) Look at the street name for the record in view.
3) If the street name is Main Street, copy the record
contents to a list.
4) If there are no more records, close the file and quit.
5) Otherwise, get the next record.
6) Go to step 2 and repeat the process.
For those of you who haven't written such a linear search
program before, take the time to write a computer program to execute
these 6 steps. Use the data file, FAMILIES.DAT, included with this
issue of CNEWS. You could use the printer to display your list or
have your program create another file containing the Main Street
Report. The record structure in the data file is as follows:
struct {
char name[25];
char street[25];
char street_number[10];
char other_data[68];
} family;
Note that there are 191 records in the file and there are 12
families that reside on Main Street. Oh, yes, I almost forgot.
The City Council was very budget conscious last summer when this
file was created and they employed a high school student who was
given the job to create this file. The student hadn't taken the
first course in typing yet and, as a result, the fields in the
file aren't as neat as they could have been. You may want to spend
a little time writing defensive code to be able to read the fields
reliably. Sorry about that but the database business IS full of
things like messy data. <GRIN>
C News 1-10 Page 9 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
DATABASE 201 -- Indexes
Well, that's pretty good if all you want to do is generate
a Main Street List from a 200 record file. What if you wanted to
do some more complex things, say, create a sorted listing or work
with a file having more records, perhaps several thousand records?
What if the records are significantly larger? As the database gets
bigger, it takes longer and longer to do things with it and if you're
like me you don't have the fastest cpu and hard disk in town. There
has to be a better way, a faster way to get what you want from the
database than to read it record-by-record and search each record for
the strings or numbers you want. There is a better way, it's called
indexing.
The idea of indexing is fairly straightforward. Create a file
containing index strings or keys that are created from the database
record fields that you would use during a linear search to decide
whether you had reached a desired record. For the Main Street
Search, you might want to use the street name field as the key. The
index file record, then would consist of two fields, the key and the
record number of the database record that the key came from. The
index file would then be much smaller than the database file; having
the same number but much smaller records. It would then take much
less time to manipulate the index file. When the index is searched
and a desired key is found, the database record can then be accessed
immediately using the record number from the index multiplied by the
record size to get the offset into the database file where the
desired record begins. DOS file positioning commands can then be
used to go directly to the desired record. Alternatively, you can use
the C function, ftell(), to obtain a pointer to the start of each
record before it's read.
Please understand, if you have a specific item you're looking
for and you only want to do it one time, you may want to do just the
linear search through the database file because, to create an index,
you need to read through the file at least one time anyway. The
index to a database is useful if you are going to access the database
numerous times and search for more or less randomly specified values
of the index.
There are other advantages to using the index file. It can be
sorted to reduce the search time still more. If you sort
alphabetically and search for Main Street, the search is over when
the street names beginning with 'M' have been exhausted. Adding full
records to the database can be done chronologically at the end of the
database file. When the new index file records are added to the
index file, it takes a lot less time to re-sort the index file than
C News 1-10 Page 10 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
the database file. Similarly, more than one index file can be
created to serve different purposes while keeping the chronological
sequence of the database intact.
I haven't said anything about the organization of the index
file. It can be a flat file in the simplest case or, to make the
searches faster, it can be organized in other ways with tree
organization probably the most often used. Index organization is
discussed below.
DATABASE 301 -- More Sophisticated Ways
There are ways to reduce the amount of index manipulation
required by linear searching. Some of these include Indexed
Sequential searching, tree searching, binary searching, and hashing
to name just a few.
Indexed Sequential searching is a technique in which the
database is sorted and the index contains only a fraction (about
10 percent) of the number of records that exist in the database.
Finding a record is done by locating a key close to the desired
key in the index and performing a linear search in the database
through just a small number of records near the key record. This
is very effective where the number of database records is very
large and manipulation of a regular index file would be too time
consuming or the full index won't fit in available memory.
Hashing is an approach that attempts to minimize the number of
comparisons made of the desired key with the keys in the index in
performing the search. A single access is the goal of hashing.
With this technique, a Hash Function converts the desired key to
an integer value which is interpreted as a table or array index
or as an address. The value at that index or address is then a
pointer to the desired data record or even the record itself.
More on Indexed Sequential searching and Hashing in a future
article.
Binary searching permits rapidly arriving at the index record
when using an index that is sorted in order of the key value.
(NOTE that even string keys have a "value" when compared with other
string keys. See the string comparison function descriptions in your
programming language manual).
Finding the desired database record is done by comparing the
desired key with the key at the center of the index file. If there's
a match, go right to the database record. If the desired key is
larger than the center index key, look at the index key half way
between the current index file location and the end of the index
C News 1-10 Page 11 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
file. If the desired key is smaller, look at the index key half
way toward the beginning of the index file. Continue this process
until the desired index key is found or until you have gone through
the entire file unsuccessfully in which case the search has failed.
The binary search function looks like Listing 1.
-------------------------------------------------
LISTING 1. BINARY SEARCH FUNCTION
char *k(x); /* returns pointer to key for record x */
void binary_search(long n, char *key)
{ /* n = number of records in list */
long low,mid,hi,x; /* key is desired record key */
int found;
found = FALSE;
low = 1; /* beginning of list */
hi = n; /* end of list */
while(low<=hi && !found)
{
mid = (low + hi) / 2; /* calculate middle of list */
if(strcmp(key,k(mid)) == 0) /* k(x) looks up key value */
found = TRUE; /* match is found */
else /* no match, larger or smaller key */
if(strcmp(key,k(mid))<0)
hi = mid - 1; /* key is < middle key */
else
low = mid + 1; /* key is > middle key */
} /* end while */
if(found) /* return record number found */
return(mid); /* success -- record found */
else
return(0); /* search failed -- record not found */
} /* end binary_search */
NOTE: 1.If the index list is in a file, then function k(x) will
have to access that file to get the desired key values.
2.It is assumed that the index list is sorted in ascending
order with index record n greater than index record 1.
-------------------------------------------------
C News 1-10 Page 12 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
The binary search is just about the most efficient way to
search a linear, sorted list whether that list is in memory as
implied by LISTING 1, or in a file. After all, each time a
decision is made to search in one half of the places (records)
available, the other half is excluded and doesn't have to be
searched. You can narrow the options quite rapidly with this
technique.
Note that if the database is in chronological order and the
date-time the record was added to the database is included in each
record, then a binary search of the file based on date-time can be
performed without the use of an index.
EXERCISE: Write a function to create an index list of the
FAMILIES file in memory. Use a structure for the
index list element as follows:
struct {
int recaddr; /* FAMILIES record pointer */
char key[25]; /* street name */
} index_rec;
Adapt the binary search function shown in LISTING 1
to your index.
Write a k(x) function to return the key given a list
position.
Write a program to print the Main Street List using
the above functions, and the index list in memory,
and any other functions you might need to get all
twelve Main Street records in the file.
C News 1-10 Page 13 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
---------------------------------------------
DATABASE 401 -- TREES
OKAY! You're on your way to becoming an expert or at least
more familiar with the subject of programming database search
routines. Next, with trees.
What's a tree? You ask...
Well, a tree offers a way to organize data to make it easier to
search for particular data elements. A tree is a data structure
constructed of nodes and linkages among nodes (the notion of the
linkage as distinct from the node isn't really right but I'll correct
that in just a bit). A tree is an orderly arrangement of nodes
interconnected by linkages. In C parlance, the node is a structure
containing a value or a set of values and two or more pointers to
structures of the same type as the node.
struct node {
char key[25];
int recno;
struct node *lptr;
struct node *rptr;
};
The structure depicted above may be created using the calloc()
function as described in K&R. Note that the linkages among nodes
are not separate entities but are in truth the pointers contained
within the node structure. In the above case, lptr and rptr are
the linkages between a node and its adjacent nodes in the tree.
A tree is created at its root and it grows from there. In
this case, a root is a pointer to a node. Define the pointer
thus:
struct node *root;
Now, create the first node using calloc() which returns a
pointer value. Assign that pointer value to root using a cast to
get the pointer type correct.
root = (struct node *) calloc(1, sizeof(struct node));
Note that root->lptr and root->rptr are of the same type as
the variable, root, and that they may be used with calloc() in
the same way to point or link from one node to another in the tree.
C News 1-10 Page 14 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
root->lptr = (struct node *) calloc(1, sizeof(struct node));
In this way, new nodes are generated and linked to previously
generated nodes, hence to the root of the tree. If one wanted to
reach any node in the tree, it is a relatively straightforward
matter to start at the root and follow the pointers until the
desired node is reached. Welllll...it's a bit more difficult
than that but not a lot more. However, it does get somewhat
complex and, as I promised earlier, I'm going to keep this as
simple as I can for you and for me.
A tree has a visual appearance similar to Figure 1.
-------------------------------------------------
FIGURE 1. Basic Tree Structure
|pointer to root node
|
Root
Node
/ \
/ \
Node1 Node2
/ \ / \
/ \ / \
Node3 Node4 Node5 Node6
/ \ / \ / \ / \
etc................
-------------------------------------------------
The tree of FIGURE 1 is called a Binary Tree because each node
is linked to two other nodes further down in the tree. If each
node contains a key and a corresponding record's file address,
then the tree can represent the entire index to the database
file. Furthermore, if the keys and addresses are installed in
the nodes with the rule that keys having values lower than the
value of a key in a node can only be installed in a new node
pointed to by a left-directed pointer and higher valued keys go
into nodes pointed to by right-directed pointers, then the tree
can be searched for a key value with similar results to a binary
search on a linear, sorted list or file. WHEW! That was a
mouthful.
I don't offer proof of the above but if you assume that the
root is very close to having the middle or median value key in
the database, then it becomes apparent that if you search for a
C News 1-10 Page 15 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
specific key value starting at the root, and, for a key value
lower than the root key value, you follow the left-directed
pointer, you will never have to follow any pointers linked to the
right-directed pointer. This is directly analogous to the binary
search described above.
Well, that's all well and good but what does it do for me and
you? The value is not in the useful but simple binary tree. It
is in what are called Multiway trees or trees that have more than
one key and more than two pointers per node. These are also
called B_Trees. These trees are searched in much the same manner
the binary tree is searched with the notable exception that at
each node containing more than two pointers to lower level nodes
in the tree, there are more than two paths that can be followed
and an appropriate number of decisions to be made to select the
right path.
A special case of a B_Tree, a B+_Tree, has special properties
which, in addition to the capability to be searched rapidly for a
random selection of key values, also lends itself to linear
searching. Well, this is getting close to my maximum confusion
index so I'll simply state that there is reason for wanting to
use structures having this kind of complexity and that reason is
search performance compared with some of the other search
techniques mentioned above.
Needless to say, programming such structures and the programs
needed to maintain and search them is not trivial. It is probably
wise to decide whether it is more important to solve the database
problem for yourself or to pursue the education needed to create
such programs. For me, the choice is obvious. I'll take the easy
way and let someone else do it for me.
If you're just dying to learn all you can about trees then try
some of the books listed in the bibliography at the end of this
article. For present purposes, I refer you to the .ARC file,
BPLUS11.ARC, included with this article. This is a shareware
package that does all this tree stuff for you and makes using trees
for database applications a whole lot easier. This isn't the only
such package. There are lots of records management support packages
available in shareware and as regular products for sale that use the
tree as well as other methods.
The following is excerpted from the B-PLUS documentation
contained in the ARC file. It would be appropriate to read it all
before you use the package. The documentation file also includes a
description of the parameters for each function as well as its
source code. Note that I have version 1.1 which isn't quite right
C News 1-10 Page 16 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
for Turbo-C, version 1.5. I spoke with Larry Hunter whose company
markets this product, and he told me that BPLUS version 1.1A solves
that and another problem. It's available on COMPUSERVE, now. In
the meantime, Larry told me how to fix the Turbo-C 1.5 compatibility
problem which I did. I've included a brief note on this along with
the BPLUS11.ARC file in file, BPLUS11.NOT.
"The B-PLUS File Indexing Module contains twelve
functions that handle the retrieval of data records
by key value. The keys that are used to locate records
are null terminated strings. The data structures and
constants that are used are defined in the header file
bplus.h."
The following are the names and descriptions of the twelve
functions:
open_index: The open_index function is used to open and
initialize an existing index file specified by
name and prepares the file for subsequent reading
or writing.
make_index: The make_index function is used to create and
initialize a new index file specified by name and
to prepare the file for subsequent reading or
writing.
close_index: The close_index file function clears the internal
cache buffer and closes the specified index file.
find_key: The find_key function searches the index file for
the key value.
locate_key: The locate key function searches the index file
for the first key value which is equal to or
greater than a specified key.
add_key: The add_key function adds new entries to the index
file.
delete_key: The delete_key function deletes entries in the
index file.
first_key: The first_key function positions the index file
pointer to the beginning of the index file. The
function next_key can then be used to list the file in
key order.
C News 1-10 Page 17 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
last_key: The last_key function positions the index file
pointer at the end of the index file. The
function previous_key can then be used to list the
file in reverse key order.
next_key: The next_key function returns the next entry in
the index file. Before next_key is called, the
index file pointer should be positioned by the
function first_key, find_key, or locate_key.
Next_key can be used to locate the desired data
record when duplicate keys are allowed. Another
use is to process files, sequentially.
prev_key: The prev_key function returns the previous entry
in the index file. Before prev_key is called, the
index file pointer should be positioned by the
function last_key, find_key, or locate_key.
Prev_key can be used to process files sequentially
in reverse order.
find_exact: The find_exact function searches the index file
for a specific key and data record position.
After playing with BPLUS for a while, I find that the only
real criticism I have is that there isn't a tree-search function
for multiple identical keys. The example program called DTEST.C
that I've provided, prints out the Main Street Report, but it
searches linearly through the index file to find the 12 Main
Street records. There are other ways to use the BPLUS functions
but this is the way I found first to make the example work. Just
the same, BPLUS works well.
-------------------------------------------------
BIBLIOGRAPHY
Borland International, Inc., Turbo C documentation, Version 1.5,
1988.
Borland International, Inc., "Turbo Pascal Database Toolbox".
Hunt, "The C Toolbox", Addison-Wesley, 1985.
Hursch and Hursch, "SQL The Structured Query Language", TAB
Books, 1988.
Kernighan and Ritchie, "The C Programming Language", Prentice-
Hall, 1978.
C News 1-10 Page 18 09 Aug 1988
================================================================
DATABASE IN C: By Arnold Cherdak
================================================================
Schwaderer, "C Wizard's Programming Reference", Wiley Press,
1985.
SoftCraft, Inc., "Btrieve User's Guide"
Tennenbaum and Augenstein, "Data Structures Using Pascal", Second
Ed., Prentice-Hall, 1986.
Tsichritzis and Lochovsky, "Data Base Management Systems",
Academic Press, 1977.
Wirth, "Algorithms + Data Structures = Programs", Prentice Hall,
1976.
C News 1-10 Page 19 09 Aug 1988
================================================================
Latest Versions of Commercial/PD Software.
================================================================
Compilers: Ver:
--------- ----
Microsoft C 5.10
QuickC 1.01
TurboC 1.5 /* With a rumored 2.0 out */
Datalight 2.1
MIX C ?
PowerC ?
Lattice C ?
Watcom 6.0
C News 1-10 Page 20 09 Aug 1988
================================================================
ARTICLE SUBMISSION STANDARDS AND ADDRESSES
================================================================
As I have repeatedly stated in this newsletter and previous
issues, I would like to see user-submitted articles, reviews or
questions. Listed below are the standards that should be
followed to make my job easier as an editor.
- Articles should be submitted in a ASCII non-formatted
file. (Margins 0-65 PLEASE)
- If the article include code fragments as examples. Then
you can include the entire source file if you like for
inclusion with the newsletter.
- Book or magazine reviews should follow the same format,
that is outlined in this issue. The publisher, author,
title, and ISBN number are a must.
- Compiler/and or product reviews, should include the
version number and manufacture. If possible, reviews
should include a sample program with benchmarks.
If you have any questions you can contact me at the
address's included on the next page.
C News 1-10 Page 21 09 Aug 1988
================================================================
ADDRESSES
================================================================
The C BBS is located at:
C BBS
% BCL Limited
P.O. Box 9162
McLean VA, 22102
or you can send netmail to:
1:109/713
C News 1-10 Page 22 15 Jul 1988
================================================================
INDEX
================================================================
Subject: Issue:
Articles:
Additional Comments of Filename Wild.. 6
Beginning C Functions 7
C Spot Run: A User Supported Library 7
Database Design in C 10
Filename Wildcard Expansion in MSC 4
Integrated Environment: TC & QC 5
Programming the Hercules Graphics Card 8
Programming the Hercules Graphics Card: Part 2 9
Talking with a Fossil 5
TurboC and Interrupts: A few Questions 2
Book Reviews:
C Chest: and other treasures. 6
C Database Development 1
C Programming Guide 1
C Programming Language 1
C Programmer's Guide to Serial Communications 3
C Programmer's Library 1
C Primer Plus 1
C the Complete Reference 2
Crafting C Tools for the IBM PC 2
Learning to Program in C 1
Microsoft C Programming on the IBM PC 1
MS-DOS Developer's Guide 4
Programming in Windows 3
QuickC Programming for the IBM 10
Reliable Data Structures in C 1
TurboC: Memory Resident Utilities 5
TurboC Programmer's Reference Book 2
Compilers:
QuickC 1
Software Reviews:
Bplus11.arc 3
C_Dates.arc 4
Cdate.arc 4
Casm.arc 3
C-subr.arc 4
C News 1-10 Page 23 09 Aug 1988
================================================================
INDEX
================================================================
Docu.arc 3
Ezwind.arc 8
Jcl-src.arc 4
Mscpopup.arc 3
Ndmake41.arc 4
Nuc-subr.arc 3
Prndoc.arc 6
Sed.arc 6
Shift_c.arc 4
Sysact11.arc 4
Tp_to_qc.arc 3
Xenixarc.arc 4
C News 1-10 Page 24 09 Aug 1988
================================================================
DISTRIBUTION POINTS
================================================================
Board Name Number Net/Node Sysop
United States
C BBS (703) 644-6478 1:109/713 Barry Lynch
Burke, VA
Jaz C-Scape (904) 724-1377 1:112/1027 Tom Evans
Jacksonville, FL
Eastern C Board (201) 247-6748 1:107/335 Todd Lehr
OTHER BOARDS THAT CARRY C NEWS:
Exec-PC (414) 964-5160 .. Bob Mahoney
Milwaukee, WI
TAMIAMI (813) 793-2392 Gerhard Barth
Naples, FL
Sound of Music (516) 536-8723(2400) Paul Waldinger
(516) 536-6819(9600 Hayes V)
Canada
Another BBS System (416) 465-7752 1:148/208 Mark Bowman
Toronto, Canada
Europe
Fido_N1_1 31-8350-37156 2:500/1 Henk Wevers
The Netherlands
Australia
Alpha-Centuri BBS 011-61-3-874-3559 3:632/348 David Nugent
C News 1-10 Page 25 09 Aug 1988
================================================================
USER RESPONSE FORM
================================================================
This form will be included as a regular feature in all future
issues of C NEWS.
What did you think of the content of this Issue? _____________
_______________________________________________________________
What improvements can you think of that would make C News a
better tool for the C Community?
_______________________________________________________________
_______________________________________________________________
What is your favorite section or sections? ___________________
_______________________________________________________________
What don't you like about C News? ____________________________
_______________________________________________________________
Additional Comments: _________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________