Connect to CDB¶
To connect to the CDB, the project must be configured (see Fortran). The example bellow shows how to connect to the CDB.
An example can be found by following:
program connect_to_CDB implicit none ! Variables integer :: nid, l, ie, index, istat character(len=30) :: filename character(len=72) :: text index = 99 ! input here the CDB name or the CDB path filename = "S:\test\connect_to_cdb.cdb" ! Connect to CDB ! In this example 64bit debug DLL is used call cdinit(filename, index) if (nid > 0) then write(*,*) " cdb_init of ", filename," succesfull ", nid else write(*,*) " cdb_init of ", filename," not succesfull ", nid endif ! Check status call cdstat(index, istat) print *, "CDB status is: ", istat ! Lets close the CDB now call cdclose(0) ! Check status again, if closed, status = 0 call cdstat(index, istat) print *, "CDB status is: ", istat ! Press <ENTER> key to close the program print *, "Press <ENTER> key to close the program" read (*,*) end program connect_to_CDB
Please modify the .CDB path in the code. If the .CDB file does not exist it will be created, because
cdbIndex=99 value (for more details please read CDBASE.CHM).
filename = "connect_to_cdb.cdb"
The interfaces example folder contains: