flat assembler
Message board for the users of flat assembler.

Index > Windows > comand console closes very fast

Author
Thread Post new topic Reply to topic
Kronos



Joined: 22 Jul 2015
Posts: 3
Location: India
Kronos
when i click run a in fasm it opens the command console and closes at the same time.why command console closes very fast and how to solve this?
Post 24 Jul 2015, 15:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17270
Location: In your JS exploiting you and your system
revolution
There are two versions of the fasm executable. fasm the console version, and fasmw the GUI IDE version.

If you run the console version without any parameters it shows the help text and exits. When Windows sees the console program exit it closes the console. To use the console version you will need to open a cmd prompt first then manually type fasm and you will then see the help text.
Post 24 Jul 2015, 17:28
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
Open your application from CMD or import system/getchar from msvcrt100.dll or whatever version you find in your System32 folder and then cinvoke-call system("pause") or getchar()
Post 24 Jul 2015, 22:19
View user's profile Send private message Reply with quote
Kronos



Joined: 22 Jul 2015
Posts: 3
Location: India
Kronos
How to run assembly code in console version?
And a other thing i tried to run console code in gui ide version thats when the console opened and closed.
thanks for the answer in advance
Post 26 Jul 2015, 10:13
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
This depends if you develop windows code or "dos" code. The IDE just starts the program and the OS decides how to do that. If it is a WIN application there will be opened a window (if you programmed this) or at least handle it as a window application. In the other way it starts this as a cmd application which is closed automatically when the application is finished.

If you try to develop this type of code it might be useful to just compile the code in the IDE (CTRL-F9 vs. F9) and open a cmd window with the same directory and start your new compiled application manually. This way the cmd window is not closed when the program finishes and you could read what your program did write on the screen. Wink
Post 26 Jul 2015, 11:34
View user's profile Send private message Send e-mail Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
El Tangas
Command line programs normally just do their job and exit, like DOS and Linux commands, so if they are fast you will only see a command window quickly flash and disappear.
To keep the output, you have to run them from a command console, on windows you can use cmd or powershell.
Post 27 Jul 2015, 12:07
View user's profile Send private message Reply with quote
Kronos



Joined: 22 Jul 2015
Posts: 3
Location: India
Kronos
Thanks guyz
Post 27 Jul 2015, 17:26
View user's profile Send private message Reply with quote
PeExecutable



Joined: 26 Jun 2015
Posts: 181
PeExecutable
As it has always been for as long as I can remember:

cmd /k (carries out the command but command line window remains open)

cmd /c (carries out the command but terminates window, unless the executing program pauses something)

An easy way to avoid that is to use the Sleep command in your program, to let it sleep for a few seconds.

You have to remember that when you execute a program from explorer, the command line window is spawned by explorer, and explorer decides exit state from it, which is set to terminate by default. If you launch a program from an already open cmd window, there is no exit state because the command line window is already opened with a non-terminate state.

If you create a fasm program you can create a new process that launches a shell command, and in that you can specify many things for the command line window, including exit states (exit or remain).

Understanding your operating system is everything. (Study the attached files, it's nasm but you'll understand it)


Description:
Download
Filename: CreateProcess.zip
Filesize: 3.84 KB
Downloaded: 91 Time(s)

Post 27 Jul 2015, 21:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.