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. How to check for filesize..

How to check for filesize..

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
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.
  • P Offline
    P Offline
    pl_kode
    wrote on last edited by
    #1

    How do I get the size of any file that I am reading in VC++. ifstream myfile; myfile.open(path); THANKS

    R T D O 4 Replies Last reply
    0
    • P pl_kode

      How do I get the size of any file that I am reading in VC++. ifstream myfile; myfile.open(path); THANKS

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #2

      Is it to solve this problem? If yes, please use the registry or an ini file to store your application related information. Those APIs exist for this very purpose.

      Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

      1 Reply Last reply
      0
      • P pl_kode

        How do I get the size of any file that I am reading in VC++. ifstream myfile; myfile.open(path); THANKS

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        and you're going to delete your question once someone replied to you ? check the CFile class for any File related operations...

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        H 1 Reply Last reply
        0
        • T toxcct

          and you're going to delete your question once someone replied to you ? check the CFile class for any File related operations...

          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          toxcct wrote:

          and you're going to delete your question once someone replied to you

          Well said. ;)

          1 Reply Last reply
          0
          • P pl_kode

            How do I get the size of any file that I am reading in VC++. ifstream myfile; myfile.open(path); THANKS

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

            Have you considering using GetFileSize() or GetFileAttributesEx()?

            "Love people and use things, not love things and use people." - Unknown

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            1 Reply Last reply
            0
            • P pl_kode

              How do I get the size of any file that I am reading in VC++. ifstream myfile; myfile.open(path); THANKS

              O Offline
              O Offline
              onlinewan
              wrote on last edited by
              #6

              long file_len; ifstream myfile; myfile.open(path); myfile.seekg(0, ios::end); file_len = myfile.tellg(); myfile.close(); ------------------------------------------ variable file_len's value is file length.

              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