I am trying to write some info to a binary file. When I open the file with Notepad, I expect to see some nonsense, but I see normal characters. I can't identify the mistake...
Program asks the user to input a string and a number, then to write it into binary file. Here is the chunk of code.
1 2 3 4 5 6 7 8 9 10 11
cout << "Input name ";
cout << "\nInput number ";
cin >> num; cin.ignore(10000, '\n'); cin.clear();
ofstream input("file", ios::out | ios::app | ios::binary); //make it a binary file
input << num << " ";
for(int i(0); name[i] != 0; i++)
input << name[i];
input << '\n';