[mercury-users] carriage return escaping

Michael Day mikeday at bigpond.net.au
Tue Aug 28 13:56:46 AEST 2001


Hi,

Can anyone explain why the output of the program below is:

"\n"
'\015'

on my system rather than:

"\015"
'\015'

or:

"\r"
'\r'

?

'\r' seems to be converted into the number 13 in the generated C code,
which seems correct. "\r" is getting converted to ^M, not sure exactly
what that is in this case.

Michael


:- module return.

:- interface.

:- import_module io.

:- pred main(io__state, io__state).
:- mode main(di, uo) is det.

:- implementation.

:- import_module char, string.

main -->
    write("\r"), nl,
    write('\r'), nl.


--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list