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. C4309 warning

C4309 warning

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
7 Posts 3 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.
  • R Offline
    R Offline
    Rakesh5
    wrote on last edited by
    #1

    hi, i am facing C4309 warning while compiling my program. can anyone help me how to solve this warning? -------------- code snippet: CString ws; if (ws.ReverseFind( '>>' ) > -1 ) ---------------------------- Thanks, Rakesh.

    C 1 Reply Last reply
    0
    • R Rakesh5

      hi, i am facing C4309 warning while compiling my program. can anyone help me how to solve this warning? -------------- code snippet: CString ws; if (ws.ReverseFind( '>>' ) > -1 ) ---------------------------- Thanks, Rakesh.

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

      Rakesh5 wrote:

      i am facing C4309 warning

      Please, next time post the full error message, it would avoid people to have to google to know what it is exactly (we don't know all the error codes by heart you know).

      Rakesh5 wrote:

      if (ws.ReverseFind( '>>' ) > -1 )

      You have to use ">>" instead of '>>'. Simple quotes (') are used for characters and double quotes (") are used for strings. Here your string will be truncated to a single character.

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

      R 1 Reply Last reply
      0
      • C Cedric Moonen

        Rakesh5 wrote:

        i am facing C4309 warning

        Please, next time post the full error message, it would avoid people to have to google to know what it is exactly (we don't know all the error codes by heart you know).

        Rakesh5 wrote:

        if (ws.ReverseFind( '>>' ) > -1 )

        You have to use ">>" instead of '>>'. Simple quotes (') are used for characters and double quotes (") are used for strings. Here your string will be truncated to a single character.

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

        R Offline
        R Offline
        Rakesh5
        wrote on last edited by
        #3

        Sorry for that inconvenience Mr.Moonen. Hereafter, i will try to give detailed picture while posting. When i tried with ">>" , it was throwing an error message. error C2664: 'ReverseFind' : cannot convert parameter 1 from 'char [3]' to 'char' This conversion requires a reinterpret_cast, a C-style cast or function-style cast. can u please tell me where am i coding wrong? Thanks, Rakesh.

        C 1 Reply Last reply
        0
        • R Rakesh5

          Sorry for that inconvenience Mr.Moonen. Hereafter, i will try to give detailed picture while posting. When i tried with ">>" , it was throwing an error message. error C2664: 'ReverseFind' : cannot convert parameter 1 from 'char [3]' to 'char' This conversion requires a reinterpret_cast, a C-style cast or function-style cast. can u please tell me where am i coding wrong? Thanks, Rakesh.

          C Offline
          C Offline
          Chris Losinger
          wrote on last edited by
          #4

          ReverseFind only works with single characters. it does not search for strings. ReverseFind[^]

          image processing toolkits | batch image processing

          R 1 Reply Last reply
          0
          • C Chris Losinger

            ReverseFind only works with single characters. it does not search for strings. ReverseFind[^]

            image processing toolkits | batch image processing

            R Offline
            R Offline
            Rakesh5
            wrote on last edited by
            #5

            ya correct. what else can we do to avoid this warning then sir?

            C C 2 Replies Last reply
            0
            • R Rakesh5

              ya correct. what else can we do to avoid this warning then sir?

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

              Search for a single character or use CString::Find[^] multiple times until the string can't be found anymore (and use the last returned index).

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

              1 Reply Last reply
              0
              • R Rakesh5

                ya correct. what else can we do to avoid this warning then sir?

                C Offline
                C Offline
                Chris Losinger
                wrote on last edited by
                #7

                int p = str.ReverseFind('>');
                if (p > 0)
                if (str.GetAt(p-1)=='>')
                then you found a match

                image processing toolkits | batch image processing

                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