hi all,
I have a binary file, then I try to read them and show the value to the screen, but what I got is always -13108. I don't know why. Here is my code
#include <iostream>
#include <fstream>
using namespace std;
void main()
{
std::fstream f_in, f_out;
short speech, value[1000];
f_in.open ("myfile.pcm", std::ios::in | std::ios::binary);
f_out.open ("test2.org", ios::out | ios::binary);
int i = 0;
while (i < 100) {
f_in.read((char *)&speech, 2);
value[i] = speech;
cout << value[i] << std::endl;
f_out.write((char *)&speech, 2);
i++;
}
}
Thks for your help