Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / February 2005

Tip: Looking for answers? Try searching our database.

new Line escape Sequences not interpreted

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mattD - 13 Feb 2005 12:30 GMT
hello all,

so here's my question are escape sequences only interpreted by the
compiler and not in the program itself. Here is a striped down example
of what brought this up.

this is a class i wrote to make a square out of astrisks based on an int
you give it.

---start driver for testing----
<HEADER STUFF>
int _tmain()
{
    STUFF TO GET int num AND CHECKIT.
    WHERE num IS YOUR int THE SIDE OF YOUR SQUARE
    THAT ALL WORKS FINE.

    //HERE's WHERE THE SQUARE GETS MADE AND DRAWN TO SCREEN.
    //AND THE PROBLEM AREA.
    Console::WriteLine(squ->SquareString(num));

return 0;
---end driver for testing----

---start squ class---
<CONSTRUCTOR STUFF>
               
String *MSquare::SquareString(int squareSide)

    STUFF TO MAKE ARRAY AND FILL IT WITH "*" AND "\n" WHERE NEEDED.
    THAT ALL WORKS FINE.

    //turn array into string and send it
    //PROBLEM AREA.
    for(int cnt2 = 0; cnt2 < arraySquare->Length; cnt2++)
    {
        strSqu = String::Concat(strSqu, arraySquare[cnt2]);
    }
return (strSqu);
---end squ class---

So if the side of your square is 4 the return statement in the class
above returns a String that looks like ****\n****\n****\n**** to the
Console::WriteLine(squ->SquareString(num)) in the driver test app.
and that is what gets printed to the screen.
****\n****\n****\n****
when i was expecting this.
****
****
****
****

Thanks,
mattD
Frank Hickman [MVP] - 13 Feb 2005 12:51 GMT
> hello all,
>
[quoted text clipped - 50 lines]
> Thanks,
> mattD

You might try "****\r\n****\r\n****\r\n****\r\n" if your using an editbox
control to display the string.  You might also need to check the multiline
checkbox in the properties of the control.

Signature

============
Frank Hickman
Microsoft MVP
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

mattD - 13 Feb 2005 14:45 GMT
>><SNIP>

Thanks i changed the "\n" in the array to "\r\n" and it works.
Thanks,
mattD

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.