Click here to Skip to main content
16,016,613 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralListCtrl with image Pin
22-May-02 20:30
suss22-May-02 20:30 
GeneralRe: ListCtrl with image Pin
Alex Cramer22-May-02 21:02
Alex Cramer22-May-02 21:02 
GeneralRe: ListCtrl with image Pin
Prem Kumar22-May-02 22:12
Prem Kumar22-May-02 22:12 
GeneralActiveX - ASP - VC++ Pin
Sameer Maggon22-May-02 20:10
Sameer Maggon22-May-02 20:10 
GeneralDebug dump question Pin
bryce22-May-02 18:21
bryce22-May-02 18:21 
GeneralRe: Debug dump question Pin
Nish Nishant22-May-02 20:44
sitebuilderNish Nishant22-May-02 20:44 
GeneralRe: Debug dump question Pin
bryce22-May-02 20:51
bryce22-May-02 20:51 
Generalaccess violation error Pin
tongc22-May-02 17:46
tongc22-May-02 17:46 
Hi all

the code fragment below compiles just fine however when i tried to access it it gives me the access violation error than the program is terminated.

here is the function:
void CAss3_q1View::OnResultsShowGroupa() 
{
	// TODO: Add your command handler code here

	CAss3_q1Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	const int TEAM = 0;
	const int PLAYED = 1;
	const int WON = 2;
	const int DRAW = 3;
	const int LOST = 4;
	const int FOR = 5;
	const int AGN = 6;
	const int POINTS = 7;

	int row, col ;
	

	int tempScore1, tempScore2;
	CString tempString;

	int result[4][4];
	int ladder[4][8];

	lineArray.push_back("Group A Result");
	
		pDoc->A.GetResults(result);		//get the result

		
		for( row = 0 ; row < 4 ; row++)
		{
			for(col = 0; col <4; col++)
			{
				if(row != col && result[row][col] >=-1)
				{
					CString team1 = pDoc->A.getTeam(row);
					CString	team2 = pDoc->A.getTeam(col);
					tempScore1 = result[row][col];
					tempScore2 = result[col][row];
					
					tempString.Format("%s %d   %s %d",team1, tempScore1, team2, tempScore2);
					
					lineArray.push_back(tempString);
				}
			}
		}
		
			//get the ladder;
	

	lineArray.push_back("Group A Table");

	pDoc->A.getLadder(ladder);

	CString team;
	int played ;
	int won ;
	int draw ;
	int lost ;
	int f0r ;	//f0r because for is reserved
	int against ;
	int points ;
	
	for(row = 0; row <4; row++)
	{
		team = pDoc->A.getTeam(ladder[row][TEAM]); //START FROM HERE, it gives me access violation problem. 
		played = ladder[row][PLAYED];
		won = ladder[row][WON];
		draw = ladder[row][DRAW];
		lost = ladder[row][LOST];
		f0r = ladder[row][FOR];	//f0r because for is reserved
		against = ladder[row][AGN];
		points = ladder[row][POINTS];
		CString tempString;
		
		
		tempString.Format("%s	%d	%d	%d	%d	%d	%d	%d",
			team, played, won, draw, lost, f0r, against, points);
		
		lineArray.push_back(tempString);
		tempString = " ";
	}
	
	Invalidate();
}

If you notice the piece of code a little bit above it is pretty similar but it works just find.

And here is the getladder implementation:
void Group::getLadder(int ladder[][8])	
{
	
	
	
	ladder = aILadder;

			
	
}

the getResuslt one is also similar :
<pre>
void Group::GetResults(int res[][4])
{
		res = result;
	
}


Please point out the problems to enlighten my newbie head Smile | :)
Cheers.
GeneralRe: access violation error Pin
Christian Graus22-May-02 17:52
protectorChristian Graus22-May-02 17:52 
GeneralRe: access violation error Pin
tongc22-May-02 18:22
tongc22-May-02 18:22 
GeneralPlease help about logon interface programming Pin
22-May-02 14:44
suss22-May-02 14:44 
GeneralRe: Please help about logon interface programming Pin
Prem Kumar22-May-02 22:08
Prem Kumar22-May-02 22:08 
GeneralUsing Excel From C++ Pin
Tony Fontenot22-May-02 13:13
Tony Fontenot22-May-02 13:13 
GeneralRe: Using Excel From C++ Pin
Aizik Yair22-May-02 21:24
Aizik Yair22-May-02 21:24 
GeneralRe: Using Excel From C++ Pin
syedhassan423-May-02 0:32
syedhassan423-May-02 0:32 
GeneralRe: Using Excel From C++ Pin
Aizik Yair23-May-02 0:59
Aizik Yair23-May-02 0:59 
GeneralRe: Using Excel From C++ Pin
KarstenK23-May-02 1:13
mveKarstenK23-May-02 1:13 
GeneralCan't find the samples :-( Pin
Zizilamoroso22-May-02 13:08
Zizilamoroso22-May-02 13:08 
GeneralRe: Can't find the samples :-( Pin
Christian Graus22-May-02 13:05
protectorChristian Graus22-May-02 13:05 
GeneralRe: Can't find the samples :-( Pin
Zizilamoroso22-May-02 13:14
Zizilamoroso22-May-02 13:14 
GeneralRe: Can't find the samples :-( Pin
PJ Arends22-May-02 14:25
professionalPJ Arends22-May-02 14:25 
GeneralRe: Can't find the samples :-( Pin
Zizilamoroso23-May-02 0:50
Zizilamoroso23-May-02 0:50 
GeneralRe: Can't find the samples :-( Pin
KarstenK22-May-02 21:47
mveKarstenK22-May-02 21:47 
GeneralRe: Can't find the samples :-( Pin
Zizilamoroso23-May-02 0:42
Zizilamoroso23-May-02 0:42 
GeneralStrange listbox mousewheel behaviour with XP Pin
22-May-02 12:07
suss22-May-02 12:07 

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.