Simple Fortran module for popen.
The library provides a routine get_command_as_string which can be used like so:
program main
use popen_module, only: get_command_as_string
implicit none
character(len=:),allocatable :: res
res = get_command_as_string('ls -l')
write(*,'(A)') res
end program mainThe latest API documentation can be found here. This was generated from the source code using FORD (i.e. by running ford ford.md).
The library can be compiled with recent versions the Intel Fortran Compiler and GFortran (and presumably any other Fortran compiler that supports modern standards).
A fpm.toml file is provided for compiling popen-fortran with the Fortran Package Manager. For example, to build:
fpm build --profile release
To run the unit tests:
fpm test --profile release
To use popen-fortran within your fpm project, add the following to your fpm.toml file:
[dependencies]
popen-fortran = { git="https://github.com/jacobwilliams/popen-fortran.git" }or, to use a specific version:
[dependencies]
popen-fortran = { git="https://github.com/jacobwilliams/popen-fortran.git", tag = "1.0.0" }- Fortran & C Interoperability [degenerateconic.com] (2014)
- C interop to popen, comp.lang.fortran, 12/2/2009.
- M_process Read or write to a process from Fortran via a C wrapper
