Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is wrong with this line of code????

Status
Not open for further replies.

testingMadd

Programmer
Joined
Aug 24, 2003
Messages
1
Location
MY
void CJoelDlg::OnSave()
{
long countZero = 0;
long countTwo = 0;

for (h=0;h<bm.bmHeight;h++)
{
//for each width in every line until height is achieved
for (w=0;w<bm.bmWidth;w++)
{
if(bw[h][w]==0) countZero++;
if(bw[h][w]==255) countTwo++;
}
}
ofstream fout(&quot;Temp Bio.dat&quot;);
fout << countZero <<&quot;;&quot; << countTwo;
fout.close();

MessageBox(&quot;values Saved&quot;);

CDialog::Invalidate();
}

i just cant seem to get this lines of code to store the values of the two arrays in a data file..... can anyone give me a suggestion of solution please????
 
you just insert in the file the last calues of countZero and countTwo.
you should
void CJoelDlg::OnSave()
{
long countZero = 0;
long countTwo = 0;

for (h=0;h<bm.bmHeight;h++)
{
//for each width in every line until height is achieved
for (w=0;w<bm.bmWidth;w++)
{
if(bw[h][w]==0) countZero++;
if(bw[h][w]==255) countTwo++;
}
}
ofstream fout(&quot;Temp Bio.dat&quot;);
for (h=0;h<bm.bmHeight;h++)
{
//for each width in every line until height is achieved
for (w=0;w<bm.bmWidth;w++)
{
countZero = bw[h][w];
countTwo = bw[h][w];
fout << countZero <<&quot;;&quot; << countTwo;
}
}
fout.close();

MessageBox(&quot;values Saved&quot;);

CDialog::Invalidate();
}

Ion Filipski
1c.bmp

ICQ: 95034075
AIM: IonFilipski
filipski@excite.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top