I'm writing a simple program that transforms a file from its original type into a binary form.
However, I'm having the following problem. The code compiles correctly but when i run it, the console window opens and never closes until i close it myself. Also, i have noticed that the longer the console window stays open, the larger the size of my newly created binary file will be. Below is my code:
#include <fstream>//to open a file
using namespace std;
int main(void){
ifstream in("in.JPG");
ofstream out("out.bin", ios::binary);
double d;
while(!in.eof()) {
out.write((char*)&d, sizeof d);
}
out.close();
in.close();
return 0;
}