Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Get week number from year, month and day parameters Pin
వేంకటనారాయణ(venkatmakam)11-Apr-11 21:19
వేంకటనారాయణ(venkatmakam)11-Apr-11 21:19 
GeneralRe: Get week number from year, month and day parameters Pin
Mc_Topaz11-Apr-11 22:06
Mc_Topaz11-Apr-11 22:06 
AnswerRe: Get week number from year, month and day parameters Pin
CPallini11-Apr-11 22:16
mveCPallini11-Apr-11 22:16 
QuestionRelease crashes but debug works. Pin
Cyclone_S11-Apr-11 13:31
Cyclone_S11-Apr-11 13:31 
AnswerRe: Release crashes but debug works. PinPopular
Luc Pattyn11-Apr-11 14:04
sitebuilderLuc Pattyn11-Apr-11 14:04 
GeneralRe: Release crashes but debug works. Pin
Albert Holguin11-Apr-11 14:09
professionalAlbert Holguin11-Apr-11 14:09 
AnswerRe: Release crashes but debug works. Pin
Albert Holguin11-Apr-11 14:07
professionalAlbert Holguin11-Apr-11 14:07 
GeneralRe: Release crashes but debug works. Pin
Cyclone_S11-Apr-11 15:42
Cyclone_S11-Apr-11 15:42 
Thanks for your reply. I found the function that crashes the Release version.

I get the error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

So it's either MyArray[50] that crashes it or the string builders.



<br />
void Read_Text()<br />
			{<br />
				char ch;<br />
				int i;<br />
				char MyArray[50];<br />
				ifstream in("scores.ini", ios::in | ios::binary); // Open the file for binary operations.<br />
										 <br />
	<br />
				while(in && ch) // Read data from file untill the end of the file is reached.<br />
				{				// "in" will be false if the end of the file has been reached.<br />
					i++;<br />
					in.get(ch);<br />
					if(in) {MyArray[i-1] = ch;}<br />
				}<br />
				in.close(); // Close the file after the file date has been read.<br />
<br />
				// Score # 1<br />
				StringBuilder^ sbA = gcnew StringBuilder(); <br />
				int iA = 0;<br />
				for(iA;MyArray[iA] != '_';iA++) // Score<br />
				{<br />
					sbA->Append((Char)MyArray[iA]);<br />
				}<br />
				String^ s = sbA->ToString(); // Convert the first score into an integer to compare with the current score.<br />
				score1 = Convert::ToInt32(s);<br />
<br />
				// Score # 2<br />
				StringBuilder^ sbB = gcnew StringBuilder(); <br />
				int iB = iA+1;<br />
				for(iB;MyArray[iB] != '_';iB++) // Score<br />
				{<br />
					sbB->Append((Char)MyArray[iB]);<br />
					<br />
				}<br />
				String^ sB = sbB->ToString(); // Convert the Second score into an integer to compare with the current score.<br />
				score2 = Convert::ToInt32(sB);<br />
<br />
				// Score # 3<br />
				StringBuilder^ sbC = gcnew StringBuilder(); <br />
				int iC = iB+1;<br />
				for(iC;MyArray[iC] != '_';iC++) // Score<br />
				{<br />
					sbC->Append((Char)MyArray[iC]);<br />
					<br />
				}<br />
				String^ sC = sbC->ToString(); // Convert the Second score into an integer to compare with the current score.<br />
				score3 = Convert::ToInt32(sC);<br />
<br />
				// Score # 4<br />
				StringBuilder^ sbD = gcnew StringBuilder(); <br />
				int iD = iC+1;<br />
				for(iC;MyArray[iD] != '_';iD++) // Score<br />
				{<br />
					sbD->Append((Char)MyArray[iD]);<br />
					<br />
				}<br />
				String^ sD = sbD->ToString(); // Convert the Second score into an integer to compare with the current score.<br />
				score4 = Convert::ToInt32(sD);<br />
<br />
<br />
				if(show_msge==true){MessageBox::Show("Top Scores\n" + Convert::ToString(score1) + "\n" + Convert::ToString(score2) + "\n"+ Convert::ToString(score3) + "\n" + Convert::ToString(score4));}<br />
			}<br />

GeneralRe: Release crashes but debug works. Pin
Albert Holguin11-Apr-11 15:57
professionalAlbert Holguin11-Apr-11 15:57 
GeneralRe: Release crashes but debug works. Pin
Stefan_Lang11-Apr-11 22:35
Stefan_Lang11-Apr-11 22:35 
GeneralRe: Release crashes but debug works. Pin
Albert Holguin12-Apr-11 4:14
professionalAlbert Holguin12-Apr-11 4:14 
GeneralRe: Release crashes but debug works. Pin
Stefan_Lang12-Apr-11 6:35
Stefan_Lang12-Apr-11 6:35 
GeneralRe: Release crashes but debug works. Pin
Albert Holguin12-Apr-11 7:09
professionalAlbert Holguin12-Apr-11 7:09 
GeneralRe: Release crashes but debug works. Pin
Stefan_Lang12-Apr-11 21:23
Stefan_Lang12-Apr-11 21:23 
GeneralRe: Release crashes but debug works. Pin
Albert Holguin11-Apr-11 16:04
professionalAlbert Holguin11-Apr-11 16:04 
GeneralRe: Release crashes but debug works. Pin
Cyclone_S15-Apr-11 9:49
Cyclone_S15-Apr-11 9:49 
AnswerRe: Release crashes but debug works. Pin
Stefan_Lang11-Apr-11 22:23
Stefan_Lang11-Apr-11 22:23 
GeneralRe: Release crashes but debug works. Pin
Cyclone_S15-Apr-11 9:45
Cyclone_S15-Apr-11 9:45 
GeneralRe: Release crashes but debug works. Pin
Stefan_Lang26-Apr-11 0:28
Stefan_Lang26-Apr-11 0:28 
QuestionCMFCMenuBar, cleartype? [Solved] Pin
bob1697211-Apr-11 6:00
bob1697211-Apr-11 6:00 
AnswerRe: CMFCMenuBar, cleartype? Pin
Hans Dietrich11-Apr-11 6:23
mentorHans Dietrich11-Apr-11 6:23 
GeneralRe: CMFCMenuBar, cleartype? Pin
bob1697211-Apr-11 7:22
bob1697211-Apr-11 7:22 
AnswerRe: CMFCMenuBar, cleartype? Pin
Hans Dietrich11-Apr-11 13:02
mentorHans Dietrich11-Apr-11 13:02 
GeneralRe: CMFCMenuBar, cleartype? Pin
bob1697211-Apr-11 10:25
bob1697211-Apr-11 10:25 
QuestionHow to implement WebSocket Client in C Pin
Parthi_Appu11-Apr-11 1:48
Parthi_Appu11-Apr-11 1:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.