News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

how to use c standard i/o in masm?

Started by t3dbundy, December 03, 2006, 08:03:32 AM

Previous topic - Next topic

t3dbundy

like this:
invoke printf,....?

but it has assembly error:
Quoteundefined symbol : printf

hutch--

Ted,

Give the MSVCRT library a try, there are both includes and a library for it but not that the formatting for printf will not work without a C compiler as it is not part of the library routine.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

t3dbundy,

You should convert C formattings like the following :

char format1[]="%s\n";

to

format1 db '%s',13,10,0

t3dbundy

use like this?

.386
.model flat,stdcall
option casemap :none

include windows.inc
include msvcrt.inc
include kernel32.inc
includelib kernel32.lib
includelib msvcrt.lib

.data
format db '%d',0

.code
start:
invoke crt_printf,addr format,67
invoke ExitProcess,NULL
end start

but,it print nothing in console.

Vortex

Did you specify the subsystem as console?

link /SUBSYSTEM:CONSOLE srcfile.obj

t3dbundy

Quote from: Vortex on December 05, 2006, 06:01:02 AM
Did you specify the subsystem as console?

link /SUBSYSTEM:CONSOLE srcfile.obj
I use ide,only hit the "Build All",let me try it,thx!

Vortex

In your IDE, you need to use something like as Build console application