B
Benry
Hey, I figured my first post would be something grand, but instead I
have this really odd issue. I'm using VC++ 6.0 in XP Home (at work,
don't ask..I'm asking to move to something different and new). I'll
just paste my code:
"""
void CCylinderControlDlg::OnOK_Clicked()
{
CString strOne;
CString strTwo;
m_editOne.GetWindowText(strOne);
m_editTwo.GetWindowText(strTwo);
if((atof(strOne) > 0) && (atof(strOne) < 1) && (atof(strTwo) > 0)){
Interval = atof(strOne);
m_LengthOfTime = atof(strTwo);
Peak = Interval/2;
Run_Summer();
}
else{
AfxMessageBox("Please enter valid data");
CDialog::OnCancel();
}
}
double* CCylinderControlDlg::Run_Summer(){
m_test=(SAMPLE_RATE * m_LengthOfTime) + 1;
m_test2=Peak*SAMPLE_RATE;
double* buffer2;
buffer2 = new double [m_test];
for(int i = 0 ; i < m_test2 ; i++){ // start rising edge of triangle
buffer2 = (i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
}
for(i = 0 ; i < m_test2 ; i++){ // start falling edge of triangle
buffer2 = (Peak - i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
}
return buffer2;
}
"""
The error I'm getting is "C:\Documents and Settings\stevenr\My
Documents\Software Related\Cylinder Control\Cylinder
ControlDlg.cpp(201) : error C2059: syntax error : '='"
And this is for the following lines:
1. m_test=(SAMPLE_RATE * m_LengthOfTime) + 1;
2. m_test2=Peak*SAMPLE_RATE;
3. buffer2 = (i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
4. buffer2 = (Peak - i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
SAMPLE_RATE has been pound defined as 10000, MAX_PEAK_VOLTAGE is 5,
m_LengthOfTime has been atof()'ed from a CString from an EditBox on a
dialog, so has Peak. I'm really wondering where this error is coming
from...I've tried to cast each of these to the correct type. I pasted
the only two functions that I've written so far today, and I can't get
paste this blasted error..it's boggling my mind! I've cleared all of
intermediate files, rebooted, rearranged, etc etc etc...and can't
understand why I'm not able to assign a value to a variable...
Anyway, any help would be appreciated. Thanks.
-Ben
have this really odd issue. I'm using VC++ 6.0 in XP Home (at work,
don't ask..I'm asking to move to something different and new). I'll
just paste my code:
"""
void CCylinderControlDlg::OnOK_Clicked()
{
CString strOne;
CString strTwo;
m_editOne.GetWindowText(strOne);
m_editTwo.GetWindowText(strTwo);
if((atof(strOne) > 0) && (atof(strOne) < 1) && (atof(strTwo) > 0)){
Interval = atof(strOne);
m_LengthOfTime = atof(strTwo);
Peak = Interval/2;
Run_Summer();
}
else{
AfxMessageBox("Please enter valid data");
CDialog::OnCancel();
}
}
double* CCylinderControlDlg::Run_Summer(){
m_test=(SAMPLE_RATE * m_LengthOfTime) + 1;
m_test2=Peak*SAMPLE_RATE;
double* buffer2;
buffer2 = new double [m_test];
for(int i = 0 ; i < m_test2 ; i++){ // start rising edge of triangle
buffer2 = (i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
}
for(i = 0 ; i < m_test2 ; i++){ // start falling edge of triangle
buffer2 = (Peak - i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
}
return buffer2;
}
"""
The error I'm getting is "C:\Documents and Settings\stevenr\My
Documents\Software Related\Cylinder Control\Cylinder
ControlDlg.cpp(201) : error C2059: syntax error : '='"
And this is for the following lines:
1. m_test=(SAMPLE_RATE * m_LengthOfTime) + 1;
2. m_test2=Peak*SAMPLE_RATE;
3. buffer2 = (i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
4. buffer2 = (Peak - i/SAMPLE_RATE) * MAX_PEAK_VOLTAGE;
SAMPLE_RATE has been pound defined as 10000, MAX_PEAK_VOLTAGE is 5,
m_LengthOfTime has been atof()'ed from a CString from an EditBox on a
dialog, so has Peak. I'm really wondering where this error is coming
from...I've tried to cast each of these to the correct type. I pasted
the only two functions that I've written so far today, and I can't get
paste this blasted error..it's boggling my mind! I've cleared all of
intermediate files, rebooted, rearranged, etc etc etc...and can't
understand why I'm not able to assign a value to a variable...
Anyway, any help would be appreciated. Thanks.
-Ben