can somone help my mate?

This is a discussion on can somone help my mate? within the C++ Programming forums, part of the General Programming Boards category; my mate is new to C++ and he uses the dev c++ compiler, one of the best around or so ...

  1. #1
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475

    can somone help my mate?

    my mate is new to C++ and he uses the dev c++ compiler, one of the best around or so i hear.

    anyway, when he comiled his program, he got no compile errors, but a warning that said:

    unknown escape sequence '\/' on line 8 which was just text
    using printf and "\n\n"
    he justs wants to know what its telling him

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    when you want to use a \ literally, you must escape it using another \
    if you don't the compile thinks you're trying to escape the next character...
    i don't know all of them by heart, but \a, \n, \b, \r, etc are all escape sequences. if the compiler come across one that it doesn't recognize, it gives you a warning....

    try this
    Code:
    int main()
    {
         char x[] = "abc\def";
         char y[] = "abc\\def";
         cout << x << endl << y << endl;
    }
    i'm thinking this should print
    abcef
    abc\def
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    somewhere, he has "\/"... basically, what that is doing is trying to find an escape character '/', which there is none... all you have to do is find that line and type "\\/" instead... that is, of course, if he wanted to print "\/"
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    when you want to use a \ literally, you must escape it using another \
    if you don't the compile thinks you're trying to escape the next character...
    i don't know all of them by heart, but \a, \n, \b, \r, etc are all escape sequences. if the compiler come across one that it doesn't recognize, it gives you a warning....

    try this
    Code:
    int main()
    {
         char x[] = "abc\def";
         char y[] = "abc\\def";
         cout << x << endl << y << endl;
    }
    i'm thinking this should print
    abcef
    abc\def
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can somone please help me with this code?
    By amsy in forum C Programming
    Replies: 1
    Last Post: 10-25-2004, 12:23 PM
  2. Could somone test this?
    By joeyzt in forum Windows Programming
    Replies: 6
    Last Post: 07-18-2003, 04:20 AM
  3. Take a look at this, mate.
    By face_master in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 08-16-2002, 06:55 AM
  4. middle east again...
    By dbaryl in forum A Brief History of Cprogramming.com
    Replies: 313
    Last Post: 05-26-2002, 03:43 AM
  5. Wise words, mate
    By buck71 in forum C Programming
    Replies: 1
    Last Post: 09-14-2001, 10:21 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21