- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hi,
I am an engineer and only write Fortran programs as and when required. In the past I have used Linux to create my code but in my present job I am using Windows 7. I only need to create a cmd line program to perform some calculations but I have a really basic problem that everytime I create an executable and run it, the cmd prompt instantly closes. This occurs even with a Hello World program!
I can see it completes the statetment in the code, it just closes the cmd prompt before I can see the output. I have have the same problem on either Windows 7 32 or 64bit. Does anybody know how I can resolve this?
Thanks,
Adam
I am an engineer and only write Fortran programs as and when required. In the past I have used Linux to create my code but in my present job I am using Windows 7. I only need to create a cmd line program to perform some calculations but I have a really basic problem that everytime I create an executable and run it, the cmd prompt instantly closes. This occurs even with a Hello World program!
I can see it completes the statetment in the code, it just closes the cmd prompt before I can see the output. I have have the same problem on either Windows 7 32 or 64bit. Does anybody know how I can resolve this?
Thanks,
Adam
- Etiquetas:
- Intel® Fortran Compiler
Enlace copiado
7 Respuestas
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
This is a consequence of using a program that is running from a graphical user-interface.
The console window exists only for the program's sake and disappears right after the
program finishes.
Open a DOS-box (via Start/Run ..., type "cmd" as the command). That gives you a command
window, like xterm in Linux, that exists independent of any program you run.
Regards,
Arjen
The console window exists only for the program's sake and disappears right after the
program finishes.
Open a DOS-box (via Start/Run ..., type "cmd" as the command). That gives you a command
window, like xterm in Linux, that exists independent of any program you run.
Regards,
Arjen
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Ok thanks Arjen, yeah that works. But it is really annoying to have type in the directory each time rather than clicking on an icon. I am sure that on occasions in the past when I have used xp or vista the program launched form the executable itself.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Well, there used to be an option/feature that the DOS box would remain open. You had to do that via
the so-called PIF editor. What I normally do, is start the DOS box from my file manager and then
I am in the right directory (that is not possible via "Windows Explorer", AFAIK, but it is via "Total Commander", my personal favourite for working with files on Windows).
Regards,
Arjen
the so-called PIF editor. What I normally do, is start the DOS box from my file manager and then
I am in the right directory (that is not possible via "Windows Explorer", AFAIK, but it is via "Total Commander", my personal favourite for working with files on Windows).
Regards,
Arjen
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Hello adam1fac,
perhaps you can try the following program:
This modified hello program will only exit when you press a keyboard key. Hope this helps.
Pedro
perhaps you can try the following program:
[fortran]Program Hello
USE IFPORT
USE IFCORE
implicit none
LOGICAL(4) pressed / .FALSE. /
write(*,'(A)') 'Hello World!'
write(*,'(A)') 'Press any key to close ...'
DO WHILE (.NOT. pressed)
pressed = PEEKCHARQQ ( )
CALL SLEEPQQ (200)
END DO
End Program Hello[/fortran] This modified hello program will only exit when you press a keyboard key. Hope this helps.
Pedro
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
..or just program in a 'PAUSE' and it will ask you to press any key to continue...and close the console window.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Let me suggest an easy alternative. If you are building from the command line, add /libs:qwin to the ifort command. If you are building in Visual Studio, select "QuickWin" as the project type rather than console. Your program will run when you double-click the EXE and the console output will appear in a window which will stay around until you request that it be closed.
- Marcar como nuevo
- Favorito
- Suscribir
- Silenciar
- Suscribirse a un feed RSS
- Resaltar
- Imprimir
- Informe de contenido inapropiado
Quoting adam1fac
Ok thanks Arjen, yeah that works. But it is really annoying to have type in the directory each time rather than clicking on an icon. I am sure that on occasions in the past when I have used xp or vista the program launched form the executable itself.
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