get_os Function

public function get_os() result(os)

Arguments

None

Return Value character(len=:), allocatable


Calls

proc~~get_os~~CallsGraph proc~get_os get_os interface~c_get_os c_get_os proc~get_os->interface~c_get_os proc~c_ptr_to_string c_ptr_to_string proc~get_os->proc~c_ptr_to_string

Called by

proc~~get_os~~CalledByGraph proc~get_os get_os proc~output_system_log output_system_log proc~output_system_log->proc~get_os interface~output_system_log type_output%output_system_log interface~output_system_log->proc~output_system_log

Source Code

    function get_os() result(os)
        implicit none
        character(:), allocatable :: os
        type(c_ptr) :: ptr

        ! C 側 c_get_os() を呼び出し
        ptr = c_get_os()

        ! NULL ポインタなら "Unknown"、そうでなければ変換関数を使う
        if (c_associated(ptr)) then
            os = c_ptr_to_string(ptr)
        else
            allocate (character(len=10) :: os)
            os = "Unknown OS"
        end if
    end function get_os