Bonjour,
j'ai un code, je ne sais pas trop comment m'y prendre. J'ai une classe CArrayString codée ci-dessous. Mon problème sur le passage en paramètre de fonctions. Je ne récupère pas ce que j'écris dans la fonction. Je ne vois pas comment la réécrire? Merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
class CArrayString  
{
 
public:
 
	CArrayString(int nb_col);
	virtual ~CArrayString();
 
	void	SetValue(int line, int column, CString value);
	CString	GetValue(int line, int column);
	int		GetLines();
	int		GetCols();
 
 
protected:
 
	int								ci_nb_cols;
	CArray<CString, CString&>	*	ca_array;
 
 
};
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 
CArrayString::CArrayString(int nb_col)
{
	ci_nb_cols	= nb_col;
	ca_array	= new CArray<CString, CString&>[ci_nb_cols];
 
}
 
 
CArrayString::~CArrayString()
{
	for(int i=0; i<ci_nb_cols; ++i)
		ca_array[i].RemoveAll();
 
/*	if ( ca_array )
		delete ca_array;*/
 
}
 
 
int CArrayString::GetLines()
{
	if ( ca_array )
		return ca_array[0].GetSize();
 
	return 0;
 
}
 
 
int	CArrayString::GetCols()
{
	if ( ca_array )
		return ci_nb_cols;
 
	return 0;
 
}
 
 
void CArrayString::SetValue(int line, int column, CString value)
{
	if ( ca_array && line >= 0 && column >= 0 && column < ci_nb_cols )
		ca_array[column].SetAtGrow(line, value);
 
}
 
 
CString	CArrayString::GetValue(int line, int column)
{
	if (ca_array && ca_array->GetSize() > column && line >= 0 && column >= 0 && line < ca_array[0].GetSize() && column < ci_nb_cols )
		return ca_array[column].GetAt(line);
 
	return "";
 
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
LoadList(CString psRequest, CArrayString *&psList, CArrayString *&psColumnNameList, CString &psErrmsg)
{	
	...
 
	psList = NULL;
 
	int nb_lines = (int)ptrMyOleDB->GetRecordCount();
 
	if ( nb_lines <= 0 )
		return true;
 
	int nb_cols = (int)ptrMyOleDB->GetFieldCount();
 
	if ( nb_cols <= 0 )
		return true;
 
	int		col;
	CString buffer;
	psList = new CArrayString(nb_cols);
 
	for( int i=0; i<nb_lines; ++i )
	{
		for(col=0; col<nb_cols; ++col)
		{
			ptrMyOleDB->GetFieldValue(col, buffer);
			psList->SetValue(i, col, buffer);
		}
	}
 
        // Verif
	for(int i=0; i<psList->GetLines(); i++)
	{
		for(int j=0; j<psList->GetCols(); j++)
		{
			CString temp = psList->GetValue(i, j); // ok, je récupère toutes les valeurs
		}
	}
 
	return true;
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
CArrayString *psList = NULL;
LoadList(psRequest, psList, psColumnNameList, psErrmsg);       
// Verif
 
 
	for(int i=0; i<list->GetLines(); i++)
	{
		for(int j=0; j<list->GetCols(); j++)
		{
			CString temp = list->GetValue(i, j); // Je récupère la première valeur mais pas les suivantes!!!!!
		}
	}