Directing a pointer value to a file.
Posted on 2003-11-11
I have a pointer variable which I declared as U8 * buffer.
I am populating this variable with data and now I want to transfer the contents to a file.
When I tried to do that, I am getting error saying:
"This Program has performed an Illegal operation and needs to be shut down".
I have my code somethig like this:
// Code for populating buffer
char *byteVals = new char[dmaBytes];
//dmaBytes is of the order of 100,000.
for(int a = 0; a < dmaBytes ; a++)
outfile<<(char)*(buffer + a); // I am getting error in this line.
In my program I had to use an array according to parameters supplied at run time and so I cannot use a predefined array length and I thought pointers can solve my problem and I shifted to pointers.
I am new to C++.
I shall be very happy if someone can help me in this.