The MASM Forum

General => The Campus => Topic started by: Ron on July 18, 2015, 02:59:45 AM

Title: Why no output to STDOUT
Post by: Ron on July 18, 2015, 02:59:45 AM
.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.
Title: Re: Why no output to STDOUT
Post by: Zen on July 18, 2015, 03:43:14 AM
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!
Title: Re: Why no output to STDOUT
Post by: rrr314159 on July 18, 2015, 03:45:11 AM
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:
Title: Re: Why no output to STDOUT
Post by: jj2007 on July 18, 2015, 05:25:19 AM
Quote from: rrr314159 on July 18, 2015, 03:45:11 AMcongratulations Ron u figured out hutch's first puzzle ... there are 23 more to get to the next level :biggrin:

Just in case you think he's joking:

QuoteMASM32 is aimed at producing assembler language programmers and was never an entry level SDK. If a new user does not know the difference between a Windows UI app and a console app, then they probably should be learning programming at an easier level. (http://masm32.com/board/index.php?topic=4356.msg46723#msg46723)
Title: Re: Why no output to STDOUT
Post by: hutch-- on July 18, 2015, 02:01:49 PM
Hi Ron,

Welcome on board.
Title: Re: Why no output to STDOUT
Post by: Ron on July 20, 2015, 11:10:21 PM
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.
Title: Re: Why no output to STDOUT
Post by: hutch-- on July 21, 2015, 11:47:24 AM
Be careful Ron, we will lead you astray.  :biggrin: