How to write a file byte by byte using c++
c++
Solution
You can try something like this:
#include <fstream>
...
ofstream fout;
fout.open("file.bin", ios::binary | ios::out);
int a[4] = {100023, 23, 42, 13};
fout.write((char*) &a, sizeof(a));
fout.close();
Problem
How to write a file byte by byte using c++? ``` unsigned short array[2]={ox20ac,0x20bc}; ``` if i have a hexadecimal value 0x20ac how can i write it byte by byte in a file using c++