fortran里怎么添加字符串?
我用vb调用fortran90,但是fortran里怎么把文件存到一个已知的文件夹里,并且自定义名字?举个例子,如vb传给fortran一个路径d:\study\program,在fortran里怎么在把文件写到d:\study\program\result里,就是在原来的文件夹里在建立个文件夹,用字符串怎么实现?谢谢了! 使用FORTRAN的字符串加法运算功能 定义字符串的时候不是得定义字符串的长度嘛!怎么相加呀?望举个例子!谢谢了!我好像没有实现呀! 从某个代码中拷贝的一段。可以将string1的长度定义的长一些。SUBROUTINE CHAPND (STRING1, STRING2)
C
C Routine to append character STRING2 to STRING1.
C
C N.B. This routine assumes that STRING1 is right padded with spaces.
C Unpredictable results will be returned if STRING1 is not right padded.
C
C STRING1 : Input base character string (with at least one terminating space)
C STRING2 : Input character string to be appended to STRING1
C
CHARACTER*(*) STRING1,
1 STRING2
C
LEN1 = ICHLNG (STRING1)
C
STRING1 = STRING1(1:LEN1) // STRING2
C
C Finished with CHAPND
C
RETURN
END
INTEGER FUNCTION ICHLNG (STRING)
C
C Function to return the length of a string defined as the location where
C the first white space is located.
C
C STRING : Input string
C
CHARACTER*80 STRING
C
LOC = 1
100 CONTINUE
IF (STRING(LOC:LOC) .EQ. ' ') THEN
GO TO 200
ENDIF
LOC = LOC + 1
IF (LOC .GT. 80) THEN
GO TO 200
ENDIF
GO TO 100
C
C Found space or end of string
C
200 CONTINUE
ICHLNG = LOC - 1
C
RETURN
END
[ 本帖最后由 苍山负雪 于 2006-5-8 09:22 编辑 ] 非常感谢!成功了!
页:
[1]