Click here to Skip to main content
16,005,491 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: _stdcall question -Thanks! Pin
Chris Richardson18-Dec-02 7:17
Chris Richardson18-Dec-02 7:17 
GeneralRe: _stdcall question -Thanks! Pin
ns18-Dec-02 9:12
ns18-Dec-02 9:12 
GeneralPointer to a pointer question Pin
pankajdaga17-Dec-02 2:49
pankajdaga17-Dec-02 2:49 
GeneralRe: Pointer to a pointer question Pin
Bangerman17-Dec-02 3:07
Bangerman17-Dec-02 3:07 
GeneralRe: Pointer to a pointer question Pin
pankajdaga17-Dec-02 3:29
pankajdaga17-Dec-02 3:29 
GeneralRe: Pointer to a pointer question Pin
Nitron17-Dec-02 3:39
Nitron17-Dec-02 3:39 
GeneralRe: Pointer to a pointer question Pin
pankajdaga17-Dec-02 3:44
pankajdaga17-Dec-02 3:44 
GeneralRe: Pointer to a pointer question Pin
Nitron17-Dec-02 4:51
Nitron17-Dec-02 4:51 
It doesn't really seem like you need a pointer to a pointer. I would use a simple wrapper class for a 2d vector and use that. Here's a demo console app showing what I mean:

#include "stdafx.h"
#include <vector>

class InnerArray
{
public:
	std::vector<int> y_value;
};

class CMyArray
{
public:

	CMyArray(const int& x_size, const int& y_size)
	{
		nx = x_size;
		ny = y_size;

		for(int x = 0; x<x_size; x++)
		{
			x_value.push_back(new InnerArray);
			for(int y=0; y<y_size; y++)
			{
				x_value[x]->y_value.push_back(0);
			}
		}
	};

	int GetData(const int& x_, const int& y_) const
	{
		return x_value[x_]->y_value[y_];
	};

	void SetData(const int& x_, const int& y_, int data)
	{
		x_value[x_]->y_value[y_] = data;
	};

	virtual ~CMyArray()
	{
	
		x_value.clear();
	};

private:
	int nx;
	int ny;
	std::vector<InnerArray*> x_value;
};

void MyFunc(CMyArray cma);

int main(int argc, char* argv[])
{

	int x=0;
	int y=0;

	CMyArray ERBaCoeff_22050(2,7);
	

	for(x=0; x<2; x++)
	{
		for(y=0; y<7; y++)
		{
			ERBaCoeff_22050.SetData(x,y,((x+1)*(y+1)));
		}
	}

	MyFunc(ERBaCoeff_22050);


	return 0;
}

void MyFunc(CMyArray cma)
{
	printf("\n\n");

	for(int x=0; x<2; x++)
	{
		for(int y=0; y<7; y++)
			printf("\nValue Of ERBaCoeff_22050[%d][%d] = %d", x,y,cma.GetData(x, y));
	}

	printf("\n\n");
}


- Nitron


"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
GeneralRe: Pointer to a pointer question Pin
pankajdaga17-Dec-02 5:06
pankajdaga17-Dec-02 5:06 
GeneralRe: Pointer to a pointer question Pin
Nitron17-Dec-02 5:10
Nitron17-Dec-02 5:10 
GeneralRe: Pointer to a pointer question Pin
pankajdaga17-Dec-02 13:21
pankajdaga17-Dec-02 13:21 
Question__unnamed_XXXXXXX_1 why? Pin
Bangerman17-Dec-02 2:45
Bangerman17-Dec-02 2:45 
AnswerRe: __unnamed_XXXXXXX_1 why? Pin
vmaltsev17-Dec-02 4:47
vmaltsev17-Dec-02 4:47 
GeneralRe: __unnamed_XXXXXXX_1 why? Pin
Bangerman19-Dec-02 0:11
Bangerman19-Dec-02 0:11 
GeneralTemperature Pin
LexKu17-Dec-02 2:18
LexKu17-Dec-02 2:18 
GeneralRe: Temperature Pin
Alois Kraus17-Dec-02 4:20
Alois Kraus17-Dec-02 4:20 
GeneralOpen File dialog adding Pin
S O S17-Dec-02 1:43
S O S17-Dec-02 1:43 
GeneralRe: Open File dialog adding Pin
Kannan Kalyanaraman17-Dec-02 2:39
Kannan Kalyanaraman17-Dec-02 2:39 
GeneralRe: Open File dialog adding Pin
S O S17-Dec-02 4:32
S O S17-Dec-02 4:32 
GeneralSwitching listbox style => scroll bar gone Pin
Geert Delmeiren17-Dec-02 1:31
Geert Delmeiren17-Dec-02 1:31 
GeneralXP Problem Pin
Anonymous17-Dec-02 1:03
Anonymous17-Dec-02 1:03 
GeneralRe: XP Problem Pin
Alvaro Mendez17-Dec-02 5:14
Alvaro Mendez17-Dec-02 5:14 
GeneralRe: XP Problem Pin
Anonymous18-Dec-02 21:31
Anonymous18-Dec-02 21:31 
GeneralXP Problem Pin
Anonymous17-Dec-02 1:03
Anonymous17-Dec-02 1:03 
Generalmotherboard serial number Pin
Mahesh Varma17-Dec-02 0:56
Mahesh Varma17-Dec-02 0:56 

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.