Skip to content

Getting an option for an allocatable character variable #19

@tuncaen

Description

@tuncaen

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
    ....

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions