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. allocating disk space

allocating disk space

Scheduled Pinned Locked Moved C / C++ / MFC
csshelptutorial
8 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
    sundar_mca
    wrote on last edited by
    #1

    My application needs allocate disk space to some of it's directories. For example: directory "Client1" with 2 mb and directory "Client2" with 3 mb My application should be able to write data of (2+3) 5 mb to those directories. But with or *without* writing any data, The Windows should feel those directories have taken that much space. Or when other applications check the free disk space, Windows must show 5 mb less in the actual space. IS any functions are there to partiton the hard disk and also to lock the folder Please help me -- modified at 7:00 Friday 3rd February, 2006

    A J D 3 Replies Last reply
    0
    • S sundar_mca

      My application needs allocate disk space to some of it's directories. For example: directory "Client1" with 2 mb and directory "Client2" with 3 mb My application should be able to write data of (2+3) 5 mb to those directories. But with or *without* writing any data, The Windows should feel those directories have taken that much space. Or when other applications check the free disk space, Windows must show 5 mb less in the actual space. IS any functions are there to partiton the hard disk and also to lock the folder Please help me -- modified at 7:00 Friday 3rd February, 2006

      A Offline
      A Offline
      Axonn Echysttas
      wrote on last edited by
      #2

      Well just fill a file with zeros ::- ). -= E C H Y S T T A S =- The Greater Mind Balance

      1 Reply Last reply
      0
      • S sundar_mca

        My application needs allocate disk space to some of it's directories. For example: directory "Client1" with 2 mb and directory "Client2" with 3 mb My application should be able to write data of (2+3) 5 mb to those directories. But with or *without* writing any data, The Windows should feel those directories have taken that much space. Or when other applications check the free disk space, Windows must show 5 mb less in the actual space. IS any functions are there to partiton the hard disk and also to lock the folder Please help me -- modified at 7:00 Friday 3rd February, 2006

        J Offline
        J Offline
        John R Shaw
        wrote on last edited by
        #3

        I do not know if that is possible, directly. Here is a way that you may be able to do it: 1) create a file that takes up the required space. This file contains no valid data, it is just a place holder. The idea here is just to insure that you have at least that much disk space to work with. 2) When you need to add another file to the directory, calculate how many bytes of data it will require. Then reduce the size of the place holder by that many bytes, before you save the new file. I recommend that durring testing, that you verify that the number of bytes you calculated matches the actual number of bytes required. That should do the trick, but there are many other things you should consider provided that the number of bytes required might excceed what you think they will. INTP Every thing is relative...

        S 1 Reply Last reply
        0
        • J John R Shaw

          I do not know if that is possible, directly. Here is a way that you may be able to do it: 1) create a file that takes up the required space. This file contains no valid data, it is just a place holder. The idea here is just to insure that you have at least that much disk space to work with. 2) When you need to add another file to the directory, calculate how many bytes of data it will require. Then reduce the size of the place holder by that many bytes, before you save the new file. I recommend that durring testing, that you verify that the number of bytes you calculated matches the actual number of bytes required. That should do the trick, but there are many other things you should consider provided that the number of bytes required might excceed what you think they will. INTP Every thing is relative...

          S Offline
          S Offline
          sundar_mca
          wrote on last edited by
          #4

          ok sir Is there any function specific how to partition the hard disk to allocate some space for my application,also how to lock (or) hide folder in vc

          J 1 Reply Last reply
          0
          • S sundar_mca

            ok sir Is there any function specific how to partition the hard disk to allocate some space for my application,also how to lock (or) hide folder in vc

            J Offline
            J Offline
            John R Shaw
            wrote on last edited by
            #5

            First, do not throw around the word partition so casualy. A partial answer would be yes, but only why your program is running. I am not talking about partitioning the hard-drive (do not even think of doing that), I am talking about reserving space on the disk. How you would do it I can not say, because I would need to do research just like you. I have a book around here some where that would probably tell me exactly how to do it. But the method I originaly sugested should work on any system, it does not require that your program be running in order for the space to be reserved. INTP Every thing is relative...

            S 2 Replies Last reply
            0
            • S sundar_mca

              My application needs allocate disk space to some of it's directories. For example: directory "Client1" with 2 mb and directory "Client2" with 3 mb My application should be able to write data of (2+3) 5 mb to those directories. But with or *without* writing any data, The Windows should feel those directories have taken that much space. Or when other applications check the free disk space, Windows must show 5 mb less in the actual space. IS any functions are there to partiton the hard disk and also to lock the folder Please help me -- modified at 7:00 Friday 3rd February, 2006

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

              It *almost* sounds like you need to use sparse files. Another solution would be to use SetFilePointer()/SetEndOfFile() pair.


              "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

              1 Reply Last reply
              0
              • J John R Shaw

                First, do not throw around the word partition so casualy. A partial answer would be yes, but only why your program is running. I am not talking about partitioning the hard-drive (do not even think of doing that), I am talking about reserving space on the disk. How you would do it I can not say, because I would need to do research just like you. I have a book around here some where that would probably tell me exactly how to do it. But the method I originaly sugested should work on any system, it does not require that your program be running in order for the space to be reserved. INTP Every thing is relative...

                S Offline
                S Offline
                sundar_mca
                wrote on last edited by
                #7

                ok sir Tell the some useful books which i could refer for memory management and i have one thing how to restrict the folder so that other user shoud not access my folder

                1 Reply Last reply
                0
                • J John R Shaw

                  First, do not throw around the word partition so casualy. A partial answer would be yes, but only why your program is running. I am not talking about partitioning the hard-drive (do not even think of doing that), I am talking about reserving space on the disk. How you would do it I can not say, because I would need to do research just like you. I have a book around here some where that would probably tell me exactly how to do it. But the method I originaly sugested should work on any system, it does not require that your program be running in order for the space to be reserved. INTP Every thing is relative...

                  S Offline
                  S Offline
                  sundar_mca
                  wrote on last edited by
                  #8

                  How to allocate space dynamically to my application.Is there any functions to use and how can it be usefull explain me ok.

                  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