Not sure why this code is truncating (sorry)
I tried using what you suggested and just had unexpected results. I'm sure I'm just doing it wrong but how do I get your code to work with this:
void CRerayDlg::OnMessageButton2()
{
if (m_fis == 1) // Set to decimal
{
float worka=0;
float workb=0;
float workc=0;
UpdateData(TRUE);
worka = m_feet/2 + (m_overhang/12);
workb = (((m_feet/2) + (m_overhang/12))*m_pitch)/12;
worka = worka*worka;
workb = workb*workb;
workc = sqrt(worka+workb);
m_feet2 = workc;
m_feet2_c.EnableWindow(TRUE);
UpdateData(FALSE);
}
if (m_fis == 0) // Set to sixteenths
{
UpdateData(TRUE);
const int MAX=7;
char string[MAX];
_itoa(m_feet,string,2);
int six = atoi(string.substr(string.length() - 2, 2).c_str());
int inch = atoi(string.substr(string.length() - 4, 2).c_str());
int feet = atoi(string.substr(0, string.length() - 4).c_str());
double final = (((six / 16.0) + inch) / feet) + feet;
m_feet2=final;
MessageBox("Still Working On", "Whatever", MB_ICONEXCLAMATION);
UpdateData(FALSE);
}
}
C:\My Documents\Programming\Reray\RerayDlg.cpp(252) : error C2228: left of '.substr' must have class/struct/union type