ifstream fp;
fp.open(path, ios::in | ios::binary); //path is the path of the DICOM file I want to read
fstream output;
output.open("C:\\Users\\Z00\\dump.txt", ios::in | ios::out | ios::trunc | ios::binary);
if (fp.is_open())
{
while (getline(fp, rbuffer))
output << rbuffer;
fp.close();
}
I used the above code to read from a DICOM file to a txt file in binary mode.
Now If I open the text file using notepad or any other document viewer, it shows exactly the same contents a hex editor shows when I open the DICOM file.
Now I want to manipulate the data inside of the text document. So I tried printing the contents of the text file into the console, But it prints complete gibberish.
Why?
And how should I go about if I want to access and manipulate the binary data?