This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: read CSV data consistently from string or file


On 10/12/18 1:10 PM, Browning, Robert S IV ERDC-RDE-GSL-MS CIV wrote:
I am needing to read in a text file that contains numerical data separated by keywords. Because of the keywords, I need to read each line in as text first and test if it’s a keyword, and then call the appropriate subroutine based on the keyword value. Within the subroutines I also need to read each line as text first so I can stop the subroutine when the next keyword is found.
The numerical data can be in either fixed format or comma-separated-value (CSV) format. In the CSV data, a zero could be represented by a pair of commas with no number between them. The issue I have encountered is that the read statement appears to behave differently when it is reading from a character string than when it is reading directly from the input file. If I were able to read directly from the input file, then a simple formatted read statement does everything I need. But if I am reading from a string, then things get a bit more complicated.

Hi Robert,

This may be a known bug. It sounds familiar. Let me do some checking.

Fortranners, if I confirm this is the bug I think it is, I think I can squeeze some time to fix it.

Jerry


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]