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. file list in mfc

file list in mfc

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
6 Posts 6 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.
  • K Offline
    K Offline
    kamalesh82
    wrote on last edited by
    #1

    how can I iterate file pointer within a file consisting list of file. that is, when ever it iterates i get next list file using vc++(mfc) kamalesh

    E _ D P F 5 Replies Last reply
    0
    • K kamalesh82

      how can I iterate file pointer within a file consisting list of file. that is, when ever it iterates i get next list file using vc++(mfc) kamalesh

      E Offline
      E Offline
      eusto
      wrote on last edited by
      #2

      You can use CFileFind to list the files on a local disk. If you already have filenames listed in a single file, than it's up to you to find a way of cuting it into filenames. Be aware that "somename.txt.exe.pdf" is just one file...

      1 Reply Last reply
      0
      • K kamalesh82

        how can I iterate file pointer within a file consisting list of file. that is, when ever it iterates i get next list file using vc++(mfc) kamalesh

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        As far as I can understand this,You have a file with some file name's stored in it.SO you want to move to the next record(filename) in your file when user takes /performs some action and show the text/name of the file. Am I right? If yes, you can go ahead with this method : 1) Open the file. 2) Read the first element. (eg. Do this in while loop) 3) Prompt the user if he want to see the next name. 4) A)yes . show the next entry in the file B)No . Break out of the loop. You can use fread for reading the elements in the file. Somethings seem HARD to do, until we know how to do them. ;-) _AnShUmAn_ -- modified at 6:53 Friday 23rd June, 2006

        1 Reply Last reply
        0
        • K kamalesh82

          how can I iterate file pointer within a file consisting list of file. that is, when ever it iterates i get next list file using vc++(mfc) kamalesh

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

          kamalesh82 wrote:

          how can I iterate file pointer within a file consisting list of file.

          That really depends on how you are reading the file. Any read operation on a file will advance the file pointer automatically. You can also do it programmatically via fseek(), SetFilePointer(), or CFile::Seek().

          kamalesh82 wrote:

          that is, when ever it iterates i get next list file using vc++(mfc)

          Are you using the CFileFind?


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

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

          1 Reply Last reply
          0
          • K kamalesh82

            how can I iterate file pointer within a file consisting list of file. that is, when ever it iterates i get next list file using vc++(mfc) kamalesh

            P Offline
            P Offline
            Pandele Florin
            wrote on last edited by
            #5

            I htink that you mean that you have a text file, containing file names, each file name on a line of text and you want to iterate throug it. If that is true, you have to read the file one char at a time and stop when you get to the combination CRLF (0x0d 0x0a).This is an line end. If your text file is written in UNICODE be aware that 1 unicode char has 16 bits(2 bytes).The "normal" one has 8 bits(1 byte).

            1 Reply Last reply
            0
            • K kamalesh82

              how can I iterate file pointer within a file consisting list of file. that is, when ever it iterates i get next list file using vc++(mfc) kamalesh

              F Offline
              F Offline
              ftsOne
              wrote on last edited by
              #6

              I just read in the file into a CString object and tokenize to the new line character using a while loop. i.e. filename = fileContent.Tokenize("\n",iStart); hope this helps. Ferdinad

              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