escape character
Lucian Botha
lucian@saao.ac.za
Fri Dec 19 12:53:00 GMT 2008
Hi
I get the following error when I take out the \
So it's still not working
cheers
Lucian
SEE-SAAO.FOR:111.38:
1 K1,time(k),IH(K),':',IM(K),':',IS(K),I1(K),I2(K),
1
Error: Syntax error in WRITE statement at (1)
SEE-SAAO.FOR:111.6:
1 K1,time(k),IH(K),':',IM(K),':',IS(K),I1(K),I2(K),
1
Error: Bad continuation line at (1)
Arjen Markus wrote:
>> Hi
>>
>> I'd like to use a colon as a time separater hh:mm:ss in a sequenc of
>> numbers to be printed to file.
>>
>> Code:
>>
>>
>> WRITE(11,'(I4,2X,f7.4,1x,I3,A1,I3,A1,I3,2X,2I4,2(2X,2F6.2),2X,F4.1)')
>> 1 K1,time(k),IH(K),\:,IM(K),\:,IS(K),I1(K),I2(K),
>> 1 FWHML(K),FWHMT(K),FWHMLZ(K),FWHMTZ(K),ZD(K)
>>
>> WRITE(40,'(I4,2X,f7.4,1x,I3,A1,I3,A1,I3,2X,2I4,2(2X,2F6.2),2X,F4.1)')
>> 1 K1,time(k),IH(K),\:,IM(K),\:,IS(K),I1(K),I2(K),
>> 1 FWHML(K),FWHMT(K),FWHMLZ(K),FWHMTZ(K),ZD(K)
>>
>> from I3, A1,I3,A1,I3
>>
>> represents e.g
>>
>> 12:25:44
>>
>>
>> But colon : is also a delimeter
>>
>> I'm using gfortran: GNU Fortran (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3) on
>> Hardy (ubuntu)
>>
>>
>
> The colon (:) is not a delimiter perse - at least not according
> to the Fortran standard. In the above WRITE statement replace \:
> by ':' and it should work fine.
>
> Colons play a special role in I/O formats (I do not remember the
> details - I never use colons in formats), but in the above
> context you should treat them as ordinary characters.
>
> Regards,
>
> Arjen
>
>
More information about the Fortran
mailing list