Sending "\n" as a string?

This is a discussion on Sending "\n" as a string? within the C++ Programming forums, part of the General Programming Boards category; I'm writing an E-mail parser to interpret the headers of incoming mail, and in the method to process the body ...

  1. #1
    Registered User applejustworks's Avatar
    Join Date
    Apr 2006
    Location
    New York, USA
    Posts
    2

    Sending "\n" as a string?

    I'm writing an E-mail parser to interpret the headers of incoming mail, and in the method to process the body of the message I need to outfile a variable, followed by the actual string "\n". Due to its symbolic meaning, the compiler is interpreting it as a "newline" command, and we need it just literally output the string itself ("\n").

    Any idea how we can do this?

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    If I understand correctly, try: "\\n"

    \\ is the escape sequence for a backslash
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    how about "\\n" -- double backslash

  4. #4
    Registered User applejustworks's Avatar
    Join Date
    Apr 2006
    Location
    New York, USA
    Posts
    2
    thanks so much guys!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 07:02 AM
  2. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  3. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM
  4. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 07:49 PM
  5. Sending a string to C++ from VB 6.
    By VirtualAce in forum C++ Programming
    Replies: 4
    Last Post: 08-21-2001, 03:28 AM

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