Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Unterminated character constant beginning at (1)

I want to have a multiline string in Fortran code. I tried to do it this way:

print *, "Line 1&
  &line 2"

But it gives me syntax errors when compiling the file gfortran myfile.f:

Error: Unterminated character constant beginning at (1)

How can I have multiline strings in a clean way?

like image 569
Ionică Bizău Avatar asked Oct 24 '25 14:10

Ionică Bizău


1 Answers

Can be easily done using string concatenation. Example (in a free-form .f90 file):

write(*,'(A)') 'Line 1'//&
               'line 2'//&
               'and so forth'
like image 63
Time Laird Avatar answered Oct 26 '25 07:10

Time Laird



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!