i can not change the value of "int index" no matter what i try
i have tried thus far using
1)index++
2)this->index++
3)using a set_index() fucntion
4)changing "index" to "*index" and changing the value it points to
5)buffered_reader::index = index+1;
note: the value of "index" does change during the scope of the get_next_data() but the func if over it returns to it's original value
shortened code(contains only the things i think are relevant to the question)
1 2 3 4 5 6 7 8 9
class buffered_reader {
private:
int index;
public:
buffered_reader(){};
//this does not change the value of index
int get_next_data(){index++;}
};
The error doesn't seem to be in the code you've posted.
Maybe your buffered_reader object is constantly going into and out of scope in your program?
Note that you should have a destructor to delete source_file (which will also close the file).
And it looks like get_next_data should return a bool.
And you shouldn't use malloc!