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. Filesize?

Filesize?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
5 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.
  • D Offline
    D Offline
    Dov Sherman
    wrote on last edited by
    #1

    This is probably a very newbieish question: In a MFC application, if CString sPathname is the full path for a valid file (i.e. sPathname = "C:\My Documents\image.bmp"), what is the simplest way to find out the size of that file?

    C J A 3 Replies Last reply
    0
    • D Dov Sherman

      This is probably a very newbieish question: In a MFC application, if CString sPathname is the full path for a valid file (i.e. sPathname = "C:\My Documents\image.bmp"), what is the simplest way to find out the size of that file?

      C Offline
      C Offline
      chepuri_uk
      wrote on last edited by
      #2

      GetFileSize()

      1 Reply Last reply
      0
      • D Dov Sherman

        This is probably a very newbieish question: In a MFC application, if CString sPathname is the full path for a valid file (i.e. sPathname = "C:\My Documents\image.bmp"), what is the simplest way to find out the size of that file?

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        CreateFile() and GetFileSize() if you use Win32 API or _stat if you're using CRT API. -- There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees. We call it master and servant.

        1 Reply Last reply
        0
        • D Dov Sherman

          This is probably a very newbieish question: In a MFC application, if CString sPathname is the full path for a valid file (i.e. sPathname = "C:\My Documents\image.bmp"), what is the simplest way to find out the size of that file?

          A Offline
          A Offline
          Abin
          wrote on last edited by
          #4

          CFileFind ff; DWORD dwSize = 0; if (ff.FindFile(_T("C:\My Documents\image.bmp"))) { ff.FindNextFile(); dwSize = ff.GetLength(); // dwSize is the file size, in bytes }

          D 1 Reply Last reply
          0
          • A Abin

            CFileFind ff; DWORD dwSize = 0; if (ff.FindFile(_T("C:\My Documents\image.bmp"))) { ff.FindNextFile(); dwSize = ff.GetLength(); // dwSize is the file size, in bytes }

            D Offline
            D Offline
            Dov Sherman
            wrote on last edited by
            #5

            Thanks, Bin! That was exactly what I was looking for.

            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