Skip to content

Commit 416e163

Browse files
committed
Spec and example update.
1 parent aff8fdf commit 416e163

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

doc/specs/stdlib_io.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Loads a rank-2 `array` from a text file.
1717

1818
### Syntax
1919

20-
`call ` [[stdlib_io(module):loadtxt(interface)]] `(filename, array [, skiprows] [, max_rows])`
20+
`call ` [[stdlib_io(module):loadtxt(interface)]] `(filename, array [, skiprows] [, max_rows] [, fmt])`
2121

2222
### Arguments
2323

@@ -29,6 +29,10 @@ Loads a rank-2 `array` from a text file.
2929

3030
`max_rows` (optional): Read `max_rows` lines of content after `skiprows` lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.
3131

32+
`fmt` (optional): Fortran format specifier for the text read. Defaults to the write format for the data type. Setting fmt='*' will specify list directed read.
33+
34+
35+
3236
### Return value
3337

3438
Returns an allocated rank-2 `array` with the content of `filename`.

example/io/example_loadtxt.f90

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ program example_loadtxt
33
implicit none
44
real, allocatable :: x(:, :)
55
call loadtxt('example.dat', x)
6+
7+
! Can also use list directed format if the default read fails.
8+
call loadtxt('example.dat', x, fmt='*')
69
end program example_loadtxt

0 commit comments

Comments
 (0)