- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Can somebody please tell me how to open and write in multiple files using Compaq Visual Fortran.
For example,in a simple Do iteration loop:
number=0
do i=1,100
number=number+1
What do i have to write next so that each ''number'' is written in a different file,and not overwrite the file
created with a normal open file statement.Furthermore,is there any possible way to control the file name,
so that the 100 files generated will have the following names: file_1.dat,file_2.dat,and so on.
Thank you.
For example,in a simple Do iteration loop:
number=0
do i=1,100
number=number+1
What do i have to write next so that each ''number'' is written in a different file,and not overwrite the file
created with a normal open file statement.Furthermore,is there any possible way to control the file name,
so that the 100 files generated will have the following names: file_1.dat,file_2.dat,and so on.
Thank you.
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
1 Responder
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
simply create a filename character string.
Then use an internal write to increment the filename string 'name'
use open to open the files (and close after if you no longer need)
so for example
character*255 myfilename
number=0
do i=1,100
number= number+1
write(myfilename,100) number
100 format('file_',i3.3,'.dat')
open (filename=myfilename, unit=number)
write(i,110) number
110 format(' this is file', i3.3)
end do
Then use an internal write to increment the filename string 'name'
use open to open the files (and close after if you no longer need)
so for example
character*255 myfilename
number=0
do i=1,100
number= number+1
write(myfilename,100) number
100 format('file_',i3.3,'.dat')
open (filename=myfilename, unit=number)
write(i,110) number
110 format(' this is file', i3.3)
end do
Responder
Opciones de temas
- Suscribirse a un feed RSS
- Marcar tema como nuevo
- Marcar tema como leído
- Flotar este Tema para el usuario actual
- Favorito
- Suscribir
- Página de impresión sencilla