C++ Binary Files | Read, Write Methods | CPP Programming File Management Video Tutorial



In this c++ Video tutorial, you will learn to use read and write methods with binary file to read and write blocks of data.

This tutorial explains how to save an object to a file using write method and then reading and using that object using read method

Visit to get the SOURCE CODE of this tutorial and to watch more free computer programming video tutorials.

Learn Programming in HINDI at our youtube channel

Catch us on SocialMedia

Nguồn: https://baggersoriginals.com/

Xem thêm bài viết khác: https://baggersoriginals.com/cong-nghe/

Article Categories:
Công Nghệ

Comments

  • will it work if there is a variable size memeber in the class ?

    Sarath Elayadath July 1, 2020 1:34 pm Reply
  • Where is the documentation for the libraries used?

    Stove Games Games July 1, 2020 1:34 pm Reply
  • Awesome tutorial. If we declare Person class data member 'name' as string, then anil.change() function is also changing the name of sunil to "xxxx" but not the age. Please clarify. TIA.

    Rahul Roy Jannapura Shivakumar July 1, 2020 1:34 pm Reply
  • There was no need to create classes, you could save everyone's time. But anyways thanks.

    Khurshid Ernazarov July 1, 2020 1:34 pm Reply
  • you just made the tutorial difficult using constructer, though there was no need for that

    yogender mishra July 1, 2020 1:34 pm Reply
  • This approach is very bad, because it ignores the endianness of the platform (the order in which bytes are stored in a multi-byte number) and data layout in memory (packed vs. unpacked), and therefore it is higly unportable and prone to data corruption. Don't follow these advices in real production code!

    Bon Bon July 1, 2020 1:34 pm Reply
  • can you please explain why we need to use person(char *name,int age) ?? why we need to use pointer there? enlighten me please

    Hafidz Razman July 1, 2020 1:34 pm Reply
  • Can u please give me your email/Skype/WhatsApp information

    hemanth music July 1, 2020 1:34 pm Reply
  • Hi, I have a doubt can you please help me

    hemanth music July 1, 2020 1:34 pm Reply
  • What happens if we exclude ios::in and ios::out? Isn't an fstream already implied in and out

    DickheadEnterprises July 1, 2020 1:34 pm Reply
  • tell me the significance of cin.get(ch)?

    Gurpreet Kaur July 1, 2020 1:34 pm Reply
  • what are the extensions those can be given to files

    Ganesh chowdhary Sadanala July 1, 2020 1:34 pm Reply
  • u can use string class instead of cstring to reduce complexity

    Ganesh chowdhary Sadanala July 1, 2020 1:34 pm Reply
  • The computer screen was not clear.

    Lavanya Lavan July 1, 2020 1:34 pm Reply
  • Can someone please explain me why it crashes when it reaches the exit bracket of else branch? Here's the code, in which i create a binary file, write something in it, extract the content into a different string and then displays the output to console.

    void main()
    {
    fstream file("BinaryTest.bin", ios::binary | ios::in | ios::out | ios::trunc);

    if (!file.is_open())
    {
    cout << "Error on opening file" << endl;
    }
    else
    {
    string content = "First line in binary file.";
    file.write((char*)&content, content.size());

    file.seekg(0);

    string outputContent;
    file.read((char*)&outputContent, content.size());

    cout << outputContent << endl;
    } // Here it crashes and I don't understand why

    file.close();
    }

    Adriss July 1, 2020 1:34 pm Reply
  • Voice clearity is less

    Ruchi Solanki July 1, 2020 1:34 pm Reply
  • Why there is a need of type casting object name?

    Ishan July 1, 2020 1:34 pm Reply
  • sir
    i am getting an ISO file as output. and it shows INVALID IMAGE FORMAT. i cant open it. why is that . please help

    Shahrukh Tramboo July 1, 2020 1:34 pm Reply
  • Learning Lad Rocks!! Anil Shetty is awesome!! Thank you so much… you saved my life.

    TruthWorld3D July 1, 2020 1:34 pm Reply
  • superrrrrrrrrrr

    Duaa Shabbir July 1, 2020 1:34 pm Reply
  • Good tutorial, your code is a mess, though.

    Isosceles Kramer July 1, 2020 1:34 pm Reply

Leave a Reply

Your email address will not be published. Required fields are marked *