From cce11e21e42c460eda5a947953d9c282765847cf Mon Sep 17 00:00:00 2001 From: Olivia Appleton Date: Sun, 22 Sep 2024 15:55:42 -0500 Subject: [PATCH] Move answers to reading from answers.tsv (27) --- fortran/src/include/utils.f90 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fortran/src/include/utils.f90 b/fortran/src/include/utils.f90 index c6956a0d..caec4934 100644 --- a/fortran/src/include/utils.f90 +++ b/fortran/src/include/utils.f90 @@ -86,12 +86,12 @@ function get_answer(id) result(answer) answer%int_value = i end if case ("str") - allocate(character(len=len(trim(val))) :: answer%string_value) + allocate(character(len=len(val)) :: answer%string_value) if (.not. allocated(answer%string_value)) then print *, "Memory allocation failed for string_value. Returning error type" else answer%type = stringt - answer%string_value = trim(val) + answer%string_value = val end if case default print *, "Invalid value type. Returning error type" @@ -129,6 +129,12 @@ subroutine parse_line(line, id_out, type_out, length_out, value_out) length_out = trim(line(last_pos + 1:)) case (4) value_out = trim(line(last_pos + 1:)) + if (value_out(len(value_out):len(value_out)) == char(10)) then + value_out = value_out(0:len(value_out) - 1) ! strip \n + end if + if (value_out(len(value_out):len(value_out)) == char(13)) then + value_out = value_out(0:len(value_out) - 1) ! strip \r + end if end select return else