Jump to content

Archived

This topic is now archived and is closed to further replies.

atitthaker

carriage return and line feed diff

Recommended Posts

I am understanding that there is difference between line feed and carriage return but I am not getting the desired output.

"This is \nsample string."

shall print
This is
        sample string.

and

"This is \rsample string."

shall print
This is
sample string.

Right?
But I am getting next line from the first column only.

Plz help...

Share this post


Link to post
Share on other sites
Think about a typewriter.  A line feed moves the print head down. A carriage return moves the print head to the extreme left.  A line feed AND a carriage return (\r\n) moves the print head down AND to the left.

Share this post


Link to post
Share on other sites
now also bear in mind it varies across platforms.

*nix is just \n
windows is \r\n
and mac is strangely \n\r

Share this post


Link to post
Share on other sites
[quote author=Jenk link=topic=104738.msg417927#msg417927 date=1155904584]
and mac is strangely \n\r
[/quote]

I believe Mac is just \r or have I misunderstood something....

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.