Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Reading strings containing escape sequence.

Reading strings containing escape sequence.

Scheduled Pinned Locked Moved C / C++ / MFC
questionxmlhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Comp_Users
    wrote on last edited by
    #1

    Hi, In my application, I need to read an unicode string _T("AT+COPS=?\r") from an xml file. The problem I am facing is that when I read an string from the xml file, it is treating the elements "\r" in "AT+COPS=?\r" as 2 different characters rather than a single carriage return value. How do I get around this problem.

    C 1 Reply Last reply
    0
    • C Comp_Users

      Hi, In my application, I need to read an unicode string _T("AT+COPS=?\r") from an xml file. The problem I am facing is that when I read an string from the xml file, it is treating the elements "\r" in "AT+COPS=?\r" as 2 different characters rather than a single carriage return value. How do I get around this problem.

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      That's how it is supposed to work. Escape sequences are only used this way in string litterals (e.g., when you write the string yourself in the code). If you read that from a file, "\r" are two characters and they are treated as two independant characters. What you have to understand about escape sequences (like "\r") is that they are replaced by your compiler by a single character. If you really want to do something like you that, you will need to parse the string yourself and replace the sequence yourself.

      Cédric Moonen Software developer
      Charting control [v2.0] OpenGL game tutorial in C++

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups