jacobwilliams / csv-fortran

Read and Write CSV Files Using Modern Fortran
Other
99 stars 44 forks source link

fix issue with splitting character string #1

Closed zimmermm closed 7 years ago

zimmermm commented 7 years ago

Hi Jacob I tried to use your fortran csv module with gfortran on a windows machine. But it fails to read csv files, i.e. to tokenize the file lines. I fixed the issue but I haven't tested it on other platforms. Furthermore, the algorithm failed when the csv file only contained two columns. Best Matthias

jacobwilliams commented 7 years ago

I think what you are seeing is a gfortran bug (I've seen many related to allocatable character variables). What version are you using?

zimmermm commented 7 years ago

GNU Fortran (x86_64-win32-seh-rev0, Built by MinGW-W64 project) 5.2.0

jacobwilliams commented 7 years ago

Thanks! I'll look into it some more. I saw various bugs when I tried to use this with Gfortran originally. I think maybe if some of the cells are characters strings, it doesn't work either....need to test it again. There are some workarounds we can try. Let's keep this pull request open.

zimmermm commented 7 years ago

Ok! That would be perfect if there is a workaround without changing your library.

There is a second commit attached to the pull request that is not related to the gfortran bug (csv_file%read fails if the file only contains two columns). Shall I open this in a separate pull request?

jacobwilliams commented 7 years ago

You can leave it as is. The other change will get merged in too when I merge in this pull request.

zimmermm commented 7 years ago

Just made another commit. The skip_rows option skipped a loop but did not advance a row in the csv file.

jacobwilliams commented 7 years ago

Oops, I didn't see your last commit, but I did a similar fix myself. Your other commits are now merged in, so let me know if it works for you now. If so, we can just close this pull request. Thanks for your help!

zimmermm commented 7 years ago

Great! It works perfectly! Thank you for this library. I am also a happy user of your json_fortran library.