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. read/write 2D array from/to binary file in C++

read/write 2D array from/to binary file in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structuresperformancehelpquestion
2 Posts 2 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.
  • K Offline
    K Offline
    knapak
    wrote on last edited by
    #1

    SORRY FOR THE REPEAT PLEASE RESPOND TO THIS ONE Hi guys I'm still strugling with the problem of reading a huge file in the most efficient way. I was suggested last week to "read the file into memory as one big chunk". I think that the advice refered to reading the data in binary format instead of text. Cool... so first I have to translate my text files into binary and then read them... Problem is that all examples that I've found refer to either read a single number or things such as a struct with phone directory... How about reading a 2 dimensional array of doubles as text, save it as binary and then load it into another array after reading the binary file??? examples??? Thanks a million.

    C 1 Reply Last reply
    0
    • K knapak

      SORRY FOR THE REPEAT PLEASE RESPOND TO THIS ONE Hi guys I'm still strugling with the problem of reading a huge file in the most efficient way. I was suggested last week to "read the file into memory as one big chunk". I think that the advice refered to reading the data in binary format instead of text. Cool... so first I have to translate my text files into binary and then read them... Problem is that all examples that I've found refer to either read a single number or things such as a struct with phone directory... How about reading a 2 dimensional array of doubles as text, save it as binary and then load it into another array after reading the binary file??? examples??? Thanks a million.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Unless the array is always the same size, the first thing you need to do is write the array bounds, so you know what to do with the data when you read it. Then you can read it in, a single number at a time, or a row at a time if you'd like. Christian Graus - Microsoft MVP - C++ knapak wrote: SORRY FOR THE REPEAT PLEASE RESPOND TO THIS ONE OK - please delete the other one... Christian Graus - Microsoft MVP - C++

      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