flat assembler
Message board for the users of flat assembler.
Index
> Windows > Newline for printf ?? |
Author |
|
sylwek32 01 Nov 2006, 06:12
Here is my version:
Prints a newline. Code: format PE CONSOLE entry start include 'include/win32a.inc' section '.data' data readable writeable msg db '123456789xyz',13,10 section '.code' code readable executable start: repeat 5 cinvoke printf,msg end repeat invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32,'kernel32.dll',crtdll,'crtdll.dll' import kernel32,ExitProcess,'ExitProcess' import crtdll,printf,'printf' |
|||
01 Nov 2006, 06:12 |
|
sylwek32 01 Nov 2006, 06:26
Btw, your code is nosense.
The exe is every time larger if you want to print more text because you internally include all the strings five times. Why don't you use "loop" and let it stop after 5 loops? |
|||
01 Nov 2006, 06:26 |
|
vid 01 Nov 2006, 11:13
Quote: he exe is every time larger if you want to print more text yours is too Why don't you use "loop" and let it stop after 5 loops? |
|||
01 Nov 2006, 11:13 |
|
sleepsleep 01 Nov 2006, 12:04
i think, what tmx might be asking is how to use the \r\n format specifier for printf.
i tried the following (works) Code: msg db '123456789xyz',0 f1 db "%s",13,10,0 cinvoke printf,f1,msg but i wonder why the following doesn't work Code: f1 db "%s \r\n",0 |
|||
01 Nov 2006, 12:04 |
|
vid 01 Nov 2006, 12:09
\r and \n is translated by C compiler, not by printf
|
|||
01 Nov 2006, 12:09 |
|
sleepsleep 01 Nov 2006, 12:15
ic, thanks
|
|||
01 Nov 2006, 12:15 |
|
sylwek32 01 Nov 2006, 13:07
OOPS
|
|||
01 Nov 2006, 13:07 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.