有问题的代码是这样的:
subroutine PG_TLab_Write(c30,r,d)
implicit none
character*30 c30,leftjust
real*4 r
integer*4 d,k
if (d.eq.0) then
write(c30,'(i30)') nint(r)
elseif (d.gt.0) then
write(c30,'(f30.<d>)') r
else
k = abs(d)
write(c30,'(1pe30.<k>') r
endif
c30 = leftjust(c30)
if (d.lt.0) then
k = index(c30,'E')
c30 = c30(1:k-1)//'x10\\u'//c30(k+1:24)
endif
return
end
这真的是旧的(坏的)代码,而且我不是一个 fortran 程序员。它给出的错误如下:
Error: Nonnegative width required in format string at (1) pg-util.f:561.26:
它在段中的最后 2 个写语句上给出错误。
我的问题是如何制作 d 和 k 无符号整数以便编译?