I absolutely cannot understand where the extra characters at the beginning of the read line come from.
Main:
int main(){
DynamicMatrix Matrix1;
ifstream f1("matrix.txt", ios::in);
f1 >> Matrix1;
cout << Matrix1;
f1.close();
return 0;
}
overloaded operator in the class:
ifstream& operator>> (ifstream& ifs, DynamicMatrix &matrix){
try{
size_t *OldRows = new size_t;
*OldRows = matrix.rows;
if (!ifs.is_open()) throw DynMatrixException("Unable to read this file.");
char* loaded = new char[1000];
size_t temp_rows = 0;
size_t temp_columns = 0;
int n = 0;
while (!ifs.eof()) ifs.read(&loaded[n++], sizeof(char));
loaded[n]='\0';
//other code
}
catch...
1st screenshot
2nd screenshot