open_database()

Purpose

Obtains a database name from the user

Syntax

void open_database(mapnr, fieldnr, flags, ADDITIONAL)

Parameters

int mapnr

Number of map containing fieldnr

 

int fieldnr

Number of field from which to get the name of the database

 

int flags

Defines how the database is opened

 

ADDITIONAL

Additional variable - not used

 

The parameter flags may take any of the same values as the function db_open()

Description

The open_database() function gets a database name from the user and opens that database at generation 0 with the required value for the parameter flags. To access the database at the latest generation, use db_generation = db_get_generation().

If the user presses <Esc> the program is halted.

You can use this function if the program can work with any database, as do most of the DP4 utility programs.

The command tail -DB <dbname> can be used to override the database name that is hard-coded in the program for the first call to open_database(). The function does not then stop for user input.

The global variable db_nr is set, and the global variable db_name contains the database name entered.

See also

db_open()