The MASM Forum

General => The Campus => Topic started by: hutch-- on September 20, 2018, 03:20:10 PM

Title: Why is ignored "\n"?
Post by: hutch-- on September 20, 2018, 03:20:10 PM
Post some code and the environment you are working with and someone may be able to help you.
Title: Re: Why is ignored "\n"?
Post by: bluedevil on September 20, 2018, 05:32:06 PM
Quote from: hismaimai2000 on September 20, 2018, 02:59:34 PM
Why do I have the string is not transferred to new line, that is why ignores "\n" symbol? Help me please :(

As hutch-- says paste the code where you stuck?

If you are coding for console and using MASM32 macros consider this:
chr$() - prints string , but not escape characters
cfm$() - prints strings with escape charaters like c
Title: Re: Why is ignored "\n"?
Post by: aw27 on September 20, 2018, 06:04:27 PM
C and other languages have a preprocessor that convert escaped characters like \n and \t inside a quoted string to the correspondent ascii table codes before printf and other functions deal with the string proper. There are macros in the SDK that deal with that.
I think this is related to your confused question.
Title: Re: Why is ignored "\n"?
Post by: hutch-- on September 20, 2018, 06:14:22 PM
Give this a blast.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
    include \masm32\include\masm32rt.inc
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

comment * -----------------------------------------------------
                     Build this console app with
                  "MAKEIT.BAT" on the PROJECT menu.
        ----------------------------------------------------- *

    .code

start:
   
; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    call main
    inkey cfm$("\tPress any key ....\n")
    exit

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

main proc

    printf("\tThis is a test of printf\n\t\qNext Line\q\n");

    ret

main endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

end start