Code:
void CPeekaViewDlg::OnSave()
{
UpdateData(TRUE);
FILE *stream;
char s[255];
char file[100];
char getl[100],getl2[100];
int i=74,skipper=0,z=0,hb=0;
//select & open file
if(m_quote == 0)
{
// Quote Directory
sprintf(file,"c:/mydocu~1/programming/peekaview/%s.tre",m_truss);
//sprintf(file,"j:/mitek/quote/%s/%s.tre",m_job,m_truss);
if( (stream = fopen(file,"r+")) == NULL )
{
MessageBox(" Trusses Not Found!\nFill In The Information Below", "Error", MB_ICONEXCLAMATION);
return;
}
}
if(m_quote == 1)
{
// Production Directory
sprintf(file,"c:/mydocu~1/programming/peekaview/debug/%s.tre",m_truss);
//sprintf(file,"j:/mitek/prod/%s/%s.tre",m_job,m_truss);
if( (stream = fopen(file,"r+")) == NULL )
{
MessageBox(" Trusses Not Found!\nFill In The Information Below", "Error", MB_ICONEXCLAMATION);
return;
}
}
//quanity
fseek(stream, i, SEEK_SET);
fscanf(stream,"%s",s);
skipper = strlen(s);
z = i + skipper + 1;
fseek(stream, z, SEEK_SET);
fgets(getl,55,stream);
fseek(stream, z+56, SEEK_SET);
fgets(getl2,54,stream);
m_qty == &m_changeqty;
i = 75;
fseek(stream, i, SEEK_SET);
if(strlen(m_changeqty)==1)
{
fprintf(stream, "%s", m_qty);
}
if(strlen(m_changeqty)>1)
{
fprintf(stream, "%s%s\n", m_qty, getl);
fseek(stream, z+55, SEEK_SET);
fprintf(stream, "\n%s\n", getl2);
}
if(strlen(m_changeqty)>2)
{
fprintf(stream, "%s%s\n", m_qty, getl);
}
fclose(stream);
m_workc = getl2;
UpdateData(FALSE);
}