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