I am developing a software for data acquisition using vc++ 6.0.
I am experiencing a problem while setting a text in the dialog box.
Below is the code for writing text in the window
// The code below gets the name of the file from the edit box (whose instance is given by the name m_filename1//
// The code below outputs a data at a specific port
nlow = ( n & 0x000f);
nlow = nlow * 16;
int nhi = (n & 0x0ff0);
nhi = nhi/16;
//opening a file and writing the data and then closing it.
ofstream file (name1);
file<<"OUTPUT VOLTAGE"<<" "<<"VOLTAGE(V1) ";
file<<"VOLTAGE(V2) "<<"RATIO(V1/V2) "<<"\n";
// outputing 0 at the data port for exiting
n = 0;
// changing the name of the file by adding a number to the file
//name and incrementing it for the next operation(data
incr = incr+1;
// THE CODE LINE BELOW GIVES THE FATAL ERROR
If I comment the above line the program runs fine. I am not able to find the bug.
The error generated is invalid page fault in module KERNEL32.DLL
I am looking forward for some replies.