Hello,(adsbygoogle = window.adsbygoogle || []).push({});

I have write a fortran code to write several file, like this

CHARACTER(len=12) :: FNAME

INTEGER::ST

DO 100 ST=1,12

DO KC=1,4 !number of layer

IF(ST.EQ.1) WRITE (FNAME,10)KC

IF(ST.EQ.2) WRITE (FNAME,11)KC

IF(ST.EQ.3) WRITE (FNAME,12)KC

IF(ST.EQ.4) WRITE (FNAME,13)KC

IF(ST.EQ.5) WRITE (FNAME,14)KC

IF(ST.EQ.6) WRITE (FNAME,15)KC

IF(ST.EQ.7) WRITE (FNAME,16)KC

IF(ST.EQ.8) WRITE (FNAME,17)KC

IF(ST.EQ.9) WRITE (FNAME,18)KC

IF(ST.EQ.10) WRITE (FNAME,19)KC

IF(ST.EQ.11) WRITE (FNAME,20)KC

IF(ST.EQ.12) WRITE (FNAME,21)KC

WRITE(6,*)FNAME

OPEN(1,FILE=FNAME)

CLOSE(1)

END DO

10 FORMAT('XY01UA',I2.2,'.DAT')

11 FORMAT('XY02UA',I2.2,'.DAT')

12 FORMAT('XY03UA',I2.2,'.DAT')

13 FORMAT('XY04UA',I2.2,'.DAT')

14 FORMAT('XY05UA',I2.2,'.DAT')

15 FORMAT('XY06UA',I2.2,'.DAT')

16 FORMAT('XY07UA',I2.2,'.DAT')

17 FORMAT('XY08UA',I2.2,'.DAT')

18 FORMAT('XY09UA',I2.2,'.DAT')

19 FORMAT('XY10UA',I2.2,'.DAT')

20 FORMAT('XY11UA',I2.2,'.DAT')

21 FORMAT('XY12UA',I2.2,'.DAT')

100 CONTINUE

STOP

END

Those codes are works fine.

I only wanna know, how to change all of this files' path to another folder inside the main program folder.

Thanks in advance,

Shade

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Fortran Fortran Write Path

**Physics Forums | Science Articles, Homework Help, Discussion**