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 create memory file?

How to create memory file?

Scheduled Pinned Locked Moved C#
csharpperformancetutorialquestion
9 Posts 5 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.
  • A Offline
    A Offline
    Arish rivlin
    wrote on last edited by
    #1

    I cannot find a way to do that in C#... gave MemoryMappedFile a try, File is written to disk as well. I'm looking for a solution to write only to disk....

    A E 2 Replies Last reply
    0
    • A Arish rivlin

      I cannot find a way to do that in C#... gave MemoryMappedFile a try, File is written to disk as well. I'm looking for a solution to write only to disk....

      A Offline
      A Offline
      AhsanS
      wrote on last edited by
      #2

      You need to create a file on Hard drive? Use methods from the built in classes of .net framework (File and Stream writer)

      Ahsan Ullah Senior Software Engineer

      A 1 Reply Last reply
      0
      • A AhsanS

        You need to create a file on Hard drive? Use methods from the built in classes of .net framework (File and Stream writer)

        Ahsan Ullah Senior Software Engineer

        A Offline
        A Offline
        Arish rivlin
        wrote on last edited by
        #3

        Hi, thanks... I need the file to be in memory and not on hard drive....

        L T 2 Replies Last reply
        0
        • A Arish rivlin

          Hi, thanks... I need the file to be in memory and not on hard drive....

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Use a MemoryStream :) Works the same like writing to disk.

          A 1 Reply Last reply
          0
          • A Arish rivlin

            Hi, thanks... I need the file to be in memory and not on hard drive....

            T Offline
            T Offline
            Tom Deketelaere
            wrote on last edited by
            #5

            What type of file? And for what will it be used? Have a look at System.IO.MemoryStream

            A 1 Reply Last reply
            0
            • L Lost User

              Use a MemoryStream :) Works the same like writing to disk.

              A Offline
              A Offline
              Arish rivlin
              wrote on last edited by
              #6

              True, but I have to avoid the disk writings, that I cannot do...

              L 1 Reply Last reply
              0
              • T Tom Deketelaere

                What type of file? And for what will it be used? Have a look at System.IO.MemoryStream

                A Offline
                A Offline
                Arish rivlin
                wrote on last edited by
                #7

                I would like to place a pointer in a mapped memory file for all dll's share... It has to be in memmory for preformance rather then on disk...

                1 Reply Last reply
                0
                • A Arish rivlin

                  True, but I have to avoid the disk writings, that I cannot do...

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  The MemoryStream won't write to a file. That is, until your memory is full and Windows starts swapping to disk. You're gonna read/write a lot from several places in a single datastore? You've probably already tried it, but I still want to suggest the use of a database. There are some data-driven websites out there, serving lots o' people at once.. This site is one of them :) --Edit-- Removed some typo's..

                  1 Reply Last reply
                  0
                  • A Arish rivlin

                    I cannot find a way to do that in C#... gave MemoryMappedFile a try, File is written to disk as well. I'm looking for a solution to write only to disk....

                    E Offline
                    E Offline
                    Ennis Ray Lynch Jr
                    wrote on last edited by
                    #9

                    You would have to use the Windows API to use a Memory Mapped File and potentially unsafe code. However, I believe that the FileStream class uses the Memory Mapped File under the scenes.

                    Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
                    Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
                    Most of this sig is for Google, not ego.

                    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