0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

c++ builder > Delphi TList of records

Last updated at Posted at 2015-08-27

構造体をTListで扱いたい。

http://stackoverflow.com/questions/5797368/delphi-tlist-of-records
にdelphi版はある。

これを参考に実装中。

と思ったけど、昔のコードが見つかったので貼っておく。

void __fastcall TForm1::btnAddClick(TObject *Sender)
{
	if (m_lstData == NULL) {
		m_lstData = new TList();
	}
	data_t data;

	data.fval = 123.0;
	data.str = "TEST";

	m_lstData->Items[0]->fval = fval;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
	if (m_lstData != NULL) {
		delete m_lstData;
		m_lstData = NULL;
	}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnDispClick(TObject *Sender)
{
	data_t *data;
	for(int i=0; i<m_lstData->Count; i++) {
		data = (data_t *)m_lstData->Items[i];
		int nop=1;	// for breakpoint
	}
}
//---------------------------------------------------------------------------
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?