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 save something in memory to file?

How to save something in memory to file?

Scheduled Pinned Locked Moved C#
questioncomdata-structuresperformancehelp
3 Posts 3 Posters 1 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.
  • G Offline
    G Offline
    gigahertz205
    wrote on last edited by
    #1

    So I have implemented the binary tree shown here (http://msdn.microsoft.com/en-us/library/ms379572.aspx[^]). I have no prior knowledge in I/O and its related areas, so any quick reads would be nice. My question is, how would i save the tree (including the root as well as the internal and leaf nodes) into a file? How would i use the file after its saved? I have a decoder (just a simple program that traverses all of the tree's nodes and writes them out in console), but I would have no idea how to recall the file and decode it. Any help is appreciated.

    T S 2 Replies Last reply
    0
    • G gigahertz205

      So I have implemented the binary tree shown here (http://msdn.microsoft.com/en-us/library/ms379572.aspx[^]). I have no prior knowledge in I/O and its related areas, so any quick reads would be nice. My question is, how would i save the tree (including the root as well as the internal and leaf nodes) into a file? How would i use the file after its saved? I have a decoder (just a simple program that traverses all of the tree's nodes and writes them out in console), but I would have no idea how to recall the file and decode it. Any help is appreciated.

      T Offline
      T Offline
      TheFM234
      wrote on last edited by
      #2

      You might be able to use xml serialization to save and load the binary tree.

      1 Reply Last reply
      0
      • G gigahertz205

        So I have implemented the binary tree shown here (http://msdn.microsoft.com/en-us/library/ms379572.aspx[^]). I have no prior knowledge in I/O and its related areas, so any quick reads would be nice. My question is, how would i save the tree (including the root as well as the internal and leaf nodes) into a file? How would i use the file after its saved? I have a decoder (just a simple program that traverses all of the tree's nodes and writes them out in console), but I would have no idea how to recall the file and decode it. Any help is appreciated.

        S Offline
        S Offline
        Stephen Lintott
        wrote on last edited by
        #3

        What I would do is firstly save the traversal. Pre / Post. And then the data. .Net makes IO easy. Try the StreamWriter and StreamReader classes

        Stephen Lintott Bsc IT (RAU)

        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