Binary file to TXT file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Binary file to TXT file

My c++ program is binary file it stores data in binary file but I want it to store in txt file how can I do this. (reinterpret_cast<char *> (&st), sizeof(student))) This command read from a bInary file What is the command for reading from a txt file. Urgent help needed. Kindly

4th Jul 2021, 5:26 AM
MUHAMMAD SULEMAN
MUHAMMAD SULEMAN - avatar
1 Answer
+ 1
Basically 2 steps. 1. Read your binary file into an appropriate data structure. This could involve techniques mentioned at: https://stackoverflow.com/questions/22192254/reading-binary-data-into-struct-with-ifstream 2. Write the file using your text format. You could use << operators, endl...
12th Jul 2021, 1:02 AM
Josh Greig
Josh Greig - avatar