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. compare SW version

compare SW version

Scheduled Pinned Locked Moved C / C++ / MFC
questionannouncement
4 Posts 4 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.
  • S Offline
    S Offline
    SWDevil
    wrote on last edited by
    #1

    How can I compare two strings that contain a version? For Instance: CString string1 = 10.2.33.4 CString string2 = 10.4.22 so in this case - string2 is higher than string1. Is there a windows function that I can use (or something of the sort), or do I have for each string to break up the string at each '.' insert each part into an integer and compare each part of the two strings separately? Thanks,

    G B C 3 Replies Last reply
    0
    • S SWDevil

      How can I compare two strings that contain a version? For Instance: CString string1 = 10.2.33.4 CString string2 = 10.4.22 so in this case - string2 is higher than string1. Is there a windows function that I can use (or something of the sort), or do I have for each string to break up the string at each '.' insert each part into an integer and compare each part of the two strings separately? Thanks,

      G Offline
      G Offline
      GuyM
      wrote on last edited by
      #2

      I'm not familiar with any such Window-API function ... You'll probably have to break the strings up just like you said ... :sigh:

      1 Reply Last reply
      0
      • S SWDevil

        How can I compare two strings that contain a version? For Instance: CString string1 = 10.2.33.4 CString string2 = 10.4.22 so in this case - string2 is higher than string1. Is there a windows function that I can use (or something of the sort), or do I have for each string to break up the string at each '.' insert each part into an integer and compare each part of the two strings separately? Thanks,

        B Offline
        B Offline
        beko
        wrote on last edited by
        #3

        Hello, if you can obtain something like 10.2.33.4 and 10.4.22.0(actually same number of characters, 00.00.00.00) then you can strip the dots out and compare the numbers directly. if the number is higher than it is more recent. Bekir.

        1 Reply Last reply
        0
        • S SWDevil

          How can I compare two strings that contain a version? For Instance: CString string1 = 10.2.33.4 CString string2 = 10.4.22 so in this case - string2 is higher than string1. Is there a windows function that I can use (or something of the sort), or do I have for each string to break up the string at each '.' insert each part into an integer and compare each part of the two strings separately? Thanks,

          C Offline
          C Offline
          Cmania
          wrote on last edited by
          #4

          SWDevil wrote:

          CString string1 = 10.2.33.4 CString string2 = 10.4.22

          Parse the array of characters and Make string =10.02.33.04 & string2 = 10.04.22.00 and then compare the two. Hope it helps

          Spread wat u Know!

          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