News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Why no output to STDOUT

Started by Ron, July 18, 2015, 02:59:45 AM

Previous topic - Next topic

Ron

.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\masm32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\masm32.lib
.data
HelloWorld db "Hello World!", 0
.code
start:
invoke StdOut, addr HelloWorld
invoke ExitProcess, 0
end start

Assembles and links without errors (using Masm32's Quick Editor)  But when I run it at the Console, nothing happens. No errors. Just nothing.

Thanks

RON

SORRY! DID NOT LINK WITH SUBSYSTEM:CONSOLE.

LIVE AND LEARN.

Zen

RON,
It compiled and worked as expected on my machine.
Yes, I compiled it with the Quick Editor, using, Project menu,...Console Build All.
Then I invoked it from the Command Prompt like this:
Ron >"F:\temp Ron\Output.txt"
...So that the output is redirected to a text file in whatever directory you want,...
Output.txt says this: Hello World!

rrr314159

Hello Ron,

The program works fine. There are a couple things you could be doing wrong. First make sure you're using Console assemble and link from the qEditor Project menu. You can just go "Console Build All", the penultimate option. Then when you select "Run Program" the console window will flash and disappear - that's the second problem. Everyone else will tell you to use "waitkey" so the window stays up, but I prefer to do the following. In qEditor hit "CTRL-D" to bring up a console window. Then at the prompt type the name you gave the program file. In my case I called it "stdout.asm" so after "Console Build All" it created stdout.exe. So, at the console prompt, I type stdout then hit Enter, and you'll see "Hello World".

As I say someone else will soon tell you to use waitkey, or similar, I've always thought that rather Mickey Mouse, but you can also use that approach.

[edit] posted this b4 I saw the above, congratulations Ron u figured out hutch's first puzzle ... there are 23 more to get to the next level :biggrin:
I am NaN ;)


hutch--


Ron

GUYS!!! THANKS for all  your help to my (obviously trivial) question. Greatly appreciate it. I used to code in assembler but haven't done so in many years. Looking to return to it for some projects.

hutch--

Be careful Ron, we will lead you astray.  :biggrin: