File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ contains
252252
253253 integer :: ios, skiprows_, i
254254 character :: c
255+ character(len=:), allocatable :: line
255256 logical :: lastblank
256257
257258 skiprows_ = optval(skiprows, 0)
@@ -261,12 +262,15 @@ contains
261262 do i = 1, skiprows_
262263 read(s, *)
263264 end do
264-
265265 number_of_columns = 0
266+
267+ ! Read first non-skipped line as a whole
268+ call getline(s, line, ios)
269+ if (ios/=0 .or. .not.allocated(line)) return
270+
266271 lastblank = .true.
267- do
268- read(s, '(a)', advance='no', iostat=ios) c
269- if (ios /= 0) exit
272+ do i = 1,len(line)
273+ c = line(i:i)
270274 if (lastblank .and. .not. is_blank(c)) number_of_columns = number_of_columns + 1
271275 lastblank = is_blank(c)
272276 end do
You can’t perform that action at this time.
0 commit comments