- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hi,
currently I write in a file, close it and directly afterwards I use somewhat like
System('myprogram.exe')
Nothing special so far. The problem now is: myprogram (a second Fortran program) tries to open the file I just created in the main Fortran program. But it seems that the file writing is not finished when myprogram tries to open it. Error message is "cannot open file".
Is there an easy way to wait until the file writing is complete and the file can be accessed by other programs then? I do not want to impelement some stupid dummy loop to win time. Is there a smarter solution possible?
currently I write in a file, close it and directly afterwards I use somewhat like
System('myprogram.exe')
Nothing special so far. The problem now is: myprogram (a second Fortran program) tries to open the file I just created in the main Fortran program. But it seems that the file writing is not finished when myprogram tries to open it. Error message is "cannot open file".
Is there an easy way to wait until the file writing is complete and the file can be accessed by other programs then? I do not want to impelement some stupid dummy loop to win time. Is there a smarter solution possible?
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
3 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
What's wrong with a 'stupid' dummy loop if it does the job?
Logical logopen
logopen=.true.
...
DO WHILE(logopen )
INQUIRE(FILE='filename', err= 9999, OPENED=logopen)
enddo
call systemqq('myprogram.exe filename')
9999 ....
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Please put a call to sleepqq in there, to wait for, say, half a second between tries.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hi Steve and Anthony,
of course there is nothing wrong with your loop - I just didn't consider this idea. I am still not familiar with the newer Fortran/Library so my idea was much simpler like
DO 200 Z=1, 1000
DO 100 I=1,1000
K =K + 1
100 continue
P = P + 1
200 continue
Your suggestion is much better of course and less "stupid" :)
I turned it into
Code:
logopen=.true.
delay = 250
DO WHILE(logopen)
INQUIRE(FILE=wkfile, err=999, OPENED=logopen)
CALL SLEEPQQ(delay)
enddo
and it works fine. Thanks again.
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