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. Memory mapped files

Memory mapped files

Scheduled Pinned Locked Moved C#
performancehelp
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.
  • C Offline
    C Offline
    Chals
    wrote on last edited by
    #1

    Hi, I'm downloading a byte[] from a web service which is actually a file. I'd like to open it without having to write it to disk - mapping it to memory, but can't find a way to do it. Any help would be greatly appreciated, thanks in advance

    D L J 4 Replies Last reply
    0
    • C Chals

      Hi, I'm downloading a byte[] from a web service which is actually a file. I'd like to open it without having to write it to disk - mapping it to memory, but can't find a way to do it. Any help would be greatly appreciated, thanks in advance

      D Offline
      D Offline
      darkelv
      wrote on last edited by
      #2

      Maybe you can try: MemoryStream memoryStream = new MemoryStream(buffer);

      C 1 Reply Last reply
      0
      • C Chals

        Hi, I'm downloading a byte[] from a web service which is actually a file. I'd like to open it without having to write it to disk - mapping it to memory, but can't find a way to do it. Any help would be greatly appreciated, thanks in advance

        L Offline
        L Offline
        Le centriste
        wrote on last edited by
        #3

        In fact, you are not downloading a file, but its contents. Now, let's say you have all the bytes in your byte[]. What do you mean by "opening", "mapping to memory"? You already have it in memory. If you want the string represention, try the System.Text.Encoding.GetString(byte[]) method. -------- "I say no to drugs, but they don't listen." - Marilyn Manson

        1 Reply Last reply
        0
        • C Chals

          Hi, I'm downloading a byte[] from a web service which is actually a file. I'd like to open it without having to write it to disk - mapping it to memory, but can't find a way to do it. Any help would be greatly appreciated, thanks in advance

          L Offline
          L Offline
          Le centriste
          wrote on last edited by
          #4

          [Message Deleted]

          1 Reply Last reply
          0
          • D darkelv

            Maybe you can try: MemoryStream memoryStream = new MemoryStream(buffer);

            C Offline
            C Offline
            Chals
            wrote on last edited by
            #5

            Ok sorry I didnt explain myself very clearly: What I want to do is to start a process over the file I got in a byte[] format, as if was doing the following: System.Diagnostics.Process.Start(myFile); but instead of pointing to a physical file, I want to 'open' it from memory.

            L 1 Reply Last reply
            0
            • C Chals

              Hi, I'm downloading a byte[] from a web service which is actually a file. I'd like to open it without having to write it to disk - mapping it to memory, but can't find a way to do it. Any help would be greatly appreciated, thanks in advance

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

              This is not possible unless you write some shell extension that can "launch" in-memory file bytes (it would do this probably by writing the in-memory bytes to disk behind the scenes).

              C 1 Reply Last reply
              0
              • C Chals

                Ok sorry I didnt explain myself very clearly: What I want to do is to start a process over the file I got in a byte[] format, as if was doing the following: System.Diagnostics.Process.Start(myFile); but instead of pointing to a physical file, I want to 'open' it from memory.

                L Offline
                L Offline
                Le centriste
                wrote on last edited by
                #7

                You cannot do that, because a file name is required, which tells the shell which application to start. -------- "I say no to drugs, but they don't listen." - Marilyn Manson

                1 Reply Last reply
                0
                • J Judah Gabriel Himango

                  This is not possible unless you write some shell extension that can "launch" in-memory file bytes (it would do this probably by writing the in-memory bytes to disk behind the scenes).

                  C Offline
                  C Offline
                  Chals
                  wrote on last edited by
                  #8

                  Ok I'll have to think of a workaround. Anyway thanks for your help :)

                  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