For some reason my buffer is getting filled with jibberish, and I'm not sure why. I even checked my file with a hex editor to verify that my characters are saved in a 2 byte unicode format. I'm not sure what's wrong.
[on file open]
fseek(_file_pointer, 0, SEEK_END);
this->_length = ftell(this->_file_pointer) / sizeof(chr);
[Main]
//there is a reason for this, I just
//didn't include the code that tells why
typedef wchar_t chr;
chr *buffer = (chr*)malloc(f->_length*sizeof(chr));
if(buffer == NULL)return;
memset(buffer,0,f->_length*sizeof(chr));
f->Read_Whole_File(buffer);
f->Close();
free(buffer);
[Read_Whole_File]
void Read_Whole_File(chr *buffer)
{
if(buffer == NULL)
{
this->_IsError = true;
return;
}
fseek(this->_file_pointer, 0, SEEK_SET);
int a = sizeof(buffer[0]);//for debugging purposes
fread(buffer, a, _length, this->_file_pointer);
}