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#
  4. How to Open file which length is 2^32 bytes

How to Open file which length is 2^32 bytes

Scheduled Pinned Locked Moved C#
performancehelptutorialquestion
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.
  • H Offline
    H Offline
    Hesham Yassin
    wrote on last edited by
    #1

    I tries to open file big than 2^32 bytes. it's not working because it pass the maximum addressing in the memory and it stucks the computer. is there a solution for that problem?????? X|

    G D J H 4 Replies Last reply
    0
    • H Hesham Yassin

      I tries to open file big than 2^32 bytes. it's not working because it pass the maximum addressing in the memory and it stucks the computer. is there a solution for that problem?????? X|

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      There should be no problem opening the file. Are you saying that you are trying to read the entire file into memory? If so, then the solution is simple: Don't. Just read the part of the file that you are currently working with.

      --- single minded; short sighted; long gone;

      1 Reply Last reply
      0
      • H Hesham Yassin

        I tries to open file big than 2^32 bytes. it's not working because it pass the maximum addressing in the memory and it stucks the computer. is there a solution for that problem?????? X|

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        >4GB?? You're never going to read the entire file into memory. You have to process it piece by piece.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        1 Reply Last reply
        0
        • H Hesham Yassin

          I tries to open file big than 2^32 bytes. it's not working because it pass the maximum addressing in the memory and it stucks the computer. is there a solution for that problem?????? X|

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          As long as you're running NTFS, you should be able to open the file. You can't read it all into memory, of course; that's what FileStream [^]is for: read in small chunks at a time.

          Tech, life, family, faith: Give me a visit. I'm currently blogging about: Master's Decree: It's By My Spirit (audio) The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

          1 Reply Last reply
          0
          • H Hesham Yassin

            I tries to open file big than 2^32 bytes. it's not working because it pass the maximum addressing in the memory and it stucks the computer. is there a solution for that problem?????? X|

            H Offline
            H Offline
            Hesham Yassin
            wrote on last edited by
            #5

            computer cannot run this line if i try to open file bigger than 4GB fs = File.OpenRead(path) but the question, how can i open it in pieces?:confused:

            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