Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

About its file structure

$
0
0
Hi,
In this approach,

http://www.daniweb.com/software-development/cpp/threads/268868/reading-and-writing-binary-file-c

I don't see if it is putting any real file structure to the binary file by the following?

    #include "CarClass.h"
    #include <fstream>
    #include <sys/stat.h>
    using namespace std;
    ifstream::pos_type size;
    char * memblock;
    int main () {
    ifstream file ("read.bin", ios::in|ios::binary|ios::ate);
    if (file.is_open())
    {
    size = file.tellg();
    memblock = new char [size];
    file.seekg (0, ios::beg);
    file.read (memblock, size);
    file.close();
    cout << "the complete file content is in memory";
    delete[] memblock;
    }
    else cout << "Unable to open file";
    return 0;
    }


Many Thanks & Best Regards, Hua Min


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>