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/
Xem thêm Bài Viết:
- Cách khắc phục lỗi reboot and select proper boot device cực kỳ nhanh chóng
- Top các phần mềm diệt virus miễn phí tốt nhất và an toàn nhất
- Cách làm máy tính chạy mượt hơn win 7 vô cùng đơn giản mà bạn nên biết
- Fix lỗi Xiaomi Redmi Note 5 Pro update Android 9 treo Recovery This MIUI version cant' be installed
- How to hard reset your android phone (Samsung)
will it work if there is a variable size memeber in the class ?
Where is the documentation for the libraries used?
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.
There was no need to create classes, you could save everyone's time. But anyways thanks.
you just made the tutorial difficult using constructer, though there was no need for that
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!
can you please explain why we need to use person(char *name,int age) ?? why we need to use pointer there? enlighten me please
Can u please give me your email/Skype/WhatsApp information
Hi, I have a doubt can you please help me
What happens if we exclude ios::in and ios::out? Isn't an fstream already implied in and out
tell me the significance of cin.get(ch)?
what are the extensions those can be given to files
u can use string class instead of cstring to reduce complexity
The computer screen was not clear.
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();
}
Voice clearity is less
Why there is a need of type casting object name?
sir
i am getting an ISO file as output. and it shows INVALID IMAGE FORMAT. i cant open it. why is that . please help
Learning Lad Rocks!! Anil Shetty is awesome!! Thank you so much… you saved my life.
superrrrrrrrrrr
Good tutorial, your code is a mess, though.