Hi,
I have a code that outputs the content of an array of std::maps in binary format.

Code:
auto outfile = std::fstream(output, std::ios::out | std::ios::binary);
MatchedPair tmp;
for (int i = 0; i < sizeArray; ++i)
{ 
    for (auto itr = arr[i].cbegin(); itr != arr[i].cend(); ++itr)
    {   
        tmp.ID2 = itr_in->first;
        tmp.distance = itr_in->second;
        outfile.write((char*)&tmp, sizeof(MatchedPair));
    }   
} 
outfile.close();
The amount of maps depends on an external parameter, but it should always output the same binary file (the total amount of data is always the same).

The problem I am having is that the outputs in binary do not much, but when I translate them into txt they are actually the same!!! I am using bash cmp utility to do the check.

When comparing the binary, the difference cmp it finds is the following:

Code:
 output_1.bin output_2.bin differ: byte 3473657, line 8763 is  15 ^M  16 ^N
I honestly don't know the source of the difference and why when converting them back to txt they are actually the same .

In any case, thanks for any help you can give me!