Skip to content
Prev Previous commit
Next Next commit
loadtxt: treat negative skiprows as 0 (numpy like)
  • Loading branch information
MuellerSeb authored Apr 20, 2022
commit 5af87c6f19d707a510dbcb7d98f66432b0acc91f
4 changes: 1 addition & 3 deletions src/stdlib_io.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ contains
integer :: s
integer :: nrow, ncol, i, skiprows_, max_rows_

skiprows_ = optval(skiprows, 0)
if ( skiprows_ < 0 ) call error_stop("loadtxt: skiprows must be non-negative.")

skiprows_ = max(optval(skiprows, 0), 0)
max_rows_ = optval(max_rows, -1)

s = open(filename)
Expand Down