https://github.com/jacobwilliams/popen-fortran
Simple Fortran module for popen
https://github.com/jacobwilliams/popen-fortran
fortran fortran-package-manager popen
Last synced: 5 months ago
JSON representation
Simple Fortran module for popen
- Host: GitHub
- URL: https://github.com/jacobwilliams/popen-fortran
- Owner: jacobwilliams
- License: bsd-3-clause
- Created: 2023-04-08T13:10:06.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-02-21T12:53:35.000Z (almost 2 years ago)
- Last Synced: 2025-05-23T00:33:19.495Z (7 months ago)
- Topics: fortran, fortran-package-manager, popen
- Language: Fortran
- Homepage:
- Size: 674 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

============
Simple Fortran module for `popen`.
[](https://github.com/topics/fortran)
[](https://github.com/jacobwilliams/popen-fortran/releases/latest)
[](https://github.com/jacobwilliams/popen-fortran/actions)
### Example
The library provides a routine `get_command_as_string` which can be used like so:
```fortran
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 main
```
### Documentation
The latest API documentation can be found [here](https://jacobwilliams.github.io/popen-fortran/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford) (i.e. by running `ford ford.md`).
### Compiling
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](https://github.com/fortran-lang/fpm). 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:
```toml
[dependencies]
popen-fortran = { git="https://github.com/jacobwilliams/popen-fortran.git" }
```
or, to use a specific version:
```toml
[dependencies]
popen-fortran = { git="https://github.com/jacobwilliams/popen-fortran.git", tag = "1.0.0" }
```
### See also
* [Fortran & C Interoperability](https://degenerateconic.com/fortran-c-interoperability.html) [degenerateconic.com] (2014)
* [C interop to popen](https://groups.google.com/forum/#!topic/comp.lang.fortran/gRmQZgcMkaY), comp.lang.fortran, 12/2/2009.
* [M_process](https://github.com/urbanjost/M_process) Read or write to a process from Fortran via a C wrapper