how to interpret a carriage return

Posted on 2006-04-27
Last Modified: 2008-03-03
Ok I have an XML file I'm reading through some XML library. It has got some tags like:

<something> Some text inside of here Some more text that belongs on a new line </something>

I get the string in my c++ app and I'm trying to render it now in a win32 multiline edit control.

I want to put a line break in that sentence, but store it in the XML file so when I render the string it comes out like:

Some text inside of here
Some more text that belongs on a new line

What do I need to put in the XML document for it to interpret the carriage return?

Question by:minnirok
    LVL 86

    Accepted Solution

    Use the XML encoding for '\r\n' which is '&#xd;&#xa;', i.e.:

    Some text inside of here&#xd;&#xa;Some more text that belongs on a new line
    LVL 22

    Expert Comment

    it's not a great idea to put fixed length line breaks in.

    What if:

    (1)  The user switches the screen to 640x480 mode?  Or 2048x 1760?

    (2)  They select "Use large fonts"

    (3)  They select "33 dpi" or "120 dpi".

    (4)  They change the default system font to 32-point Agamemnon-Italic?

    LVL 7

    Author Comment

    Agreed, but I just need to put the breaks in for now,


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
    The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now