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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Finding Hex

Finding Hex

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
5 Posts 4 Posters 1 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
    rajeevktripathi
    wrote on last edited by
    #1

    Hi All I have been puzzelled in a problem, What have to do is, that I have some file names ( like 000001.doc, programming.doc, etc.) now I have to find out the files that are in hexadecimal (leaving file extension). Please guide me to find out this Thanks

    D C V 3 Replies Last reply
    0
    • R rajeevktripathi

      Hi All I have been puzzelled in a problem, What have to do is, that I have some file names ( like 000001.doc, programming.doc, etc.) now I have to find out the files that are in hexadecimal (leaving file extension). Please guide me to find out this Thanks

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Use isxdigit() on the file's name.


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      C 1 Reply Last reply
      0
      • R rajeevktripathi

        Hi All I have been puzzelled in a problem, What have to do is, that I have some file names ( like 000001.doc, programming.doc, etc.) now I have to find out the files that are in hexadecimal (leaving file extension). Please guide me to find out this Thanks

        C Offline
        C Offline
        capricious_001
        wrote on last edited by
        #3
        1. Retrieve the file list 2) Loop through each file. For every File name, loop through its name until the extension is reached and check to see if each character is either [0-9] or [A-F]. If its not, just do continue; and start back at the beginning of the loop again. Use this website to utilize the ANSI character set. http://www.alanwood.net/demos/ansi.html Remember, the letters can be either lower case or uppercase and have different ANSI codes. 3) Record the file names in an array. (Create a dynamic allocated array for big file names). Robbie
        1 Reply Last reply
        0
        • D David Crow

          Use isxdigit() on the file's name.


          "The largest fire starts but with the smallest spark." - David Crow

          "Judge not by the eye but by the heart." - Native American Proverb

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

          Ahh david's is a much easier way. Its in the following library as well! #include int isxdigit(int c);

          1 Reply Last reply
          0
          • R rajeevktripathi

            Hi All I have been puzzelled in a problem, What have to do is, that I have some file names ( like 000001.doc, programming.doc, etc.) now I have to find out the files that are in hexadecimal (leaving file extension). Please guide me to find out this Thanks

            V Offline
            V Offline
            Viorel
            wrote on last edited by
            #5

            Try this idea:

            char name[100] = "......." ; // the file's name without extension
            char * p;
            strtoul(name, &p, 16);
            
            if( *p == 0)
            {
                // the name is like a hexadecimal number, or is empty
            }
            else
            {
                // the name is not like a hexadecimal number
            }
            

            Hope it helps.

            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