Visual C++ using "&" as a string...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paulcybulski
    New Member
    • Nov 2007
    • 25

    Visual C++ using "&" as a string...

    I am trying to pass a URL to the body of an e-mail using a shell...however the string I am trying to pass as the URL contains a "&" character which is being treated as an operator by the complier and it is cutting off everything after it...is there any way to get the compiler to treat the character as any other string character so it can pass the whole string?

    please help
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Originally posted by paulcybulski
    I am trying to pass a URL to the body of an e-mail using a shell...however the string I am trying to pass as the URL contains a "&" character which is being treated as an operator by the complier and it is cutting off everything after it...is there any way to get the compiler to treat the character as any other string character so it can pass the whole string?

    please help
    Add an escape operator before you pass the URL?

    Comment

    • paulcybulski
      New Member
      • Nov 2007
      • 25

      #3
      Originally posted by RedSon
      Add an escape operator before you pass the URL?

      I am totally not a V-C++ programmer...wh at is an escape operator?

      Paul

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by paulcybulski
        I am totally not a V-C++ programmer...wh at is an escape operator?

        Paul
        something like \" or \& or \\. I escape the special character status by putting a slash before the character that I want to escape from. For example path names to files are "\\Dir\\subdir\ \file" and basically they appear to the machine as "\Dir\subdir\fi le"

        Comment

        • paulcybulski
          New Member
          • Nov 2007
          • 25

          #5
          Originally posted by RedSon
          something like \" or \& or \\. I escape the special character status by putting a slash before the character that I want to escape from. For example path names to files are "\\Dir\\subdir\ \file" and basically they appear to the machine as "\Dir\subdir\fi le"
          URLString = "http://www.expocadweb. com/07demo/ec/forms/ attendee/indexSales.aspx ?content=floorP lan\\&boothdata ="

          URLString = URLString & TotalBoothStr & HighlightStr

          mailstr = "mailto:" & Trim(Email.Text ) & "?" & "Body=" & URLString


          this is what Im trying...and it is still ending the string that goes into the body at
          floorPlan\\ ....however the "\\" is in the string...
          Last edited by RedSon; Jan 23 '08, 09:56 PM. Reason: nbsp;

          Comment

          • RedSon
            Recognized Expert Expert
            • Jan 2007
            • 4980

            #6
            What datatype is your URLString?
            Last edited by RedSon; Jan 23 '08, 09:55 PM. Reason: nbsp;

            Comment

            • paulcybulski
              New Member
              • Nov 2007
              • 25

              #7
              I figured it out...if we replace the & with %26 (the ascii translation) it works...
              Last edited by RedSon; Jan 23 '08, 09:55 PM. Reason: nbsp;

              Comment

              Working...