When I try to get an option for an allocatable character variable, %get returns an empty string. If I change the character(:), allocatable :: cvar declaration to character(64) :: cvar, it works as it should be. Should allocatables be avoided or is there a solution to this issue?
program test
use finer, only: file_ini
use penf, only: i4p
implicit none
character(:), allocatable :: cvar
type(file_ini) :: config
integer(i4p) :: error
call config%load(filename="test.ini",error=error)
if(error==0)then
call config%get(section_name="workspace",option_name='id', val=cvar, error=error)
end if
end program test
here cvar returned as undefined pointer/array where test.ini is as follow
[workspace]
id = test_1207 ; title of the analysis
....
When I try to get an option for an allocatable character variable,
%getreturns an empty string. If I change thecharacter(:), allocatable :: cvardeclaration tocharacter(64) :: cvar, it works as it should be. Should allocatables be avoided or is there a solution to this issue?here
cvarreturned as undefined pointer/array wheretest.iniis as follow