popen_module Module

A simple module for popen.


Uses

  • module~~popen_module~~UsesGraph module~popen_module popen_module iso_c_binding iso_c_binding module~popen_module->iso_c_binding

Interfaces

interface

  • private function popen(command, mode) bind(C,name='popen')

    initiate pipe streams to or from a process

    Arguments

    Type IntentOptional Attributes Name
    character(kind=c_char, len=1), dimension(*) :: command
    character(kind=c_char, len=1), dimension(*) :: mode

    Return Value type(c_ptr)

interface

  • private function fgets(s, siz, stream) bind(C,name='fgets')

    get a string from a stream

    Arguments

    Type IntentOptional Attributes Name
    character(kind=c_char, len=1), dimension(*) :: s
    integer(kind=c_int), value :: siz
    type(c_ptr), value :: stream

    Return Value type(c_ptr)

interface

  • private function pclose(stream) bind(C,name='pclose')

    close a pipe stream to or from a process

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), value :: stream

    Return Value integer(kind=c_int)


Functions

public function c2f_string(c) result(f)

Convert a C string to a Fortran string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: c

C string

Return Value character(len=:), allocatable

Fortran string

public function get_command_as_string(command) result(str)

Return the result of the command as a string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: command

the command to run

Return Value character(len=:), allocatable

the result of that command