ciao.
ho il seguente codice:
codice:
UpdateData(FALSE);

	ConnectProfileDb();

	CADOTable RsProfili;
	CString strSql= "SELECT * from Profili";
	m_db.Execute(strSql.GetBuffer(20),RsProfili);

	LPSTR chrOldType = new TCHAR[50];LPSTR chrType = new TCHAR[50];

	chrOldType = "";
	while(!RsProfili.ISEOF()){
		 
		RsProfili.Get("Tipo", chrType);
		
		TVINSERTSTRUCT tvTypeInsert;
		tvTypeInsert.hParent = NULL;
		tvTypeInsert.hInsertAfter = NULL;
		tvTypeInsert.item.mask = TVIF_TEXT;
		
		tvTypeInsert.item.pszText = chrType;
		 
	
		HTREEITEM hType = m_TreeSections.InsertItem(&tvTypeInsert);

		while(!strcmp(chrOldType, chrType)|| !strcmp(chrOldType,""))
		{
			TVINSERTSTRUCT tvDesign;
			tvDesign.hParent = hType;
			tvDesign.hInsertAfter = NULL;
			tvDesign.item.mask = TVIF_TEXT;

			LPSTR chrDes = new TCHAR[50]; 
			
			RsProfili.Get("Designazione", chrDes);
			RsProfili.Get("Tipo", chrOldType);
			
			tvDesign.item.pszText = chrDes;

			HTREEITEM hDes = m_TreeSections.InsertItem(&tvDesign);
			RsProfili.MoveNext();
		}
	}
	UpdateData(TRUE);
devo capire come vanno inizializzati i tipi LPSTR in mfc , vorei fare un buon lavoro e voglio prima capire(i memory leak li sistemo poi):
Conosco la diffferenza tra tchar Cstring, LPSTR ,se le inizializzo con il new TCHAR[xx] è tutto ok , solo che se le setto a "" non riesco piu a prendere il valore dal recordset ado, penso per il problema delle stringhe 0 terminate , ma non ne sono sicuro .
Mi interessserebbe inizializzare le variabili a "" per riconoscere la prima volta , ad es qui:
!strcmp(chrOldType,"")
dopo la prima leggo un valore dal recordset, e devo poter leggere i valori successivi.

se per es faccio questo:
codice:
    chrOldType =""
    RsProfili.Get("Tipo", chrOldType);
si pianta.
perchè?

grazie.