Connect to CDB#

C: sof_cdb_init (char* FileName, int Index)

Fortran: subroutine cdinit (FileName, index)

In: character FileName(*) In: In: integer Index
In: integer index = ReturnValue

Connect to CDB where the FileName is the path of the CDB (.cdb). It becomes the active database. This function has to be called before any other activity is allowed. In the database_help_small ‘’CDBase Help’’ description there are few Index options available. In the examples Index=99 is used where it checks if FileName is a valid database and opens it if possible with the assigned index. If the CDB doesn’t exist it will be created.

Parameters

FileName: name of the file (CDBase) including the complete path
InitType: kind of opening the database 99 is recommended. Tests if FileName is a valid database and opens the database if possible. If file does not exists it will be created.

The return values of Index are very important to handle the CDB. In our example it is necessary that the index return value must be > 0 because if the return value is < 0 it means that we have an error while trying to connect to the CDB. If we use Index = 99 and get a return value = 0, it means that the connected file is not a CDB.

The configured examples uses ‘’non-license requesting’’ DLLs. So you don’t need to have a SOFiSTiK license to read the data from the CDB (cdb_w31.dll and sof_cdb_w-2023.dll).

Warning

Note that this code won’t work if the environment and the DLL location isn’t set. You can print out the Index return value to check if the CDB connected successfully.

An example how to connect to the CDB is given in specific programming languages parts of this manual, depending on the programming language that is used.

sof_cdb_init() return values for errors#

Value

Description

-16

unknown error

-17

path not found

-18

Name not valid

-27

file not found

-28

no permission to create file

-37

too many open files

-38

no permission to write file

-47

wrong CDBase-Version

-48

file is no CDBase-file