C++ into VB

Hello,

I'm going to translate below logic into vb. I confuse what the logic trying to get. What is the relation between DevcName and the Reader_F., and what the [100] means.

Thanks!

1
2
3
4
5
6
7
8
	RdrName Reader_F[100];
	long l_ret_value = CBM_EnumerateReader(Reader_F);

	CHAR* DevcName;
	int idx;
	for(int i = 0; i< Reader_F->ul_NbRdr; i++)
	{
		DevcName = Reader_F[i].cRdrName;
I myself am pretty new to C++, but I believe [100] is good indication that you're dealing with arrays. The for loop also points into that direction.
Your code seems a little incomplete to me...are there other statements in the for loop cause your closing brace is missing.
full code is like this. not understand the function in bold. is that array in Reader_F

RdrName Reader_F[100];
long l_ret_value = EnumerateReader(Reader_F);

CHAR* DevcName;
int idx;
for(int i = 0; i< Reader_F->ul_NbRdr; i++)
{
DevcName = Reader_F[i].cRdrName;
idx = m_RdrNameCBM.AddString(DevcName);
m_RdrNameCBM.SetItemDataPtr(idx,DevcName);
UpdateData(FALSE);
}
m_RdrNameCBM.SetCurSel(0);
Reader_F is the array that can store 100 elements of the type RdrName

That's what EnumerateReader does: it stores a certain amount of objects (type RdrName) and returns in l_ret_value how many objects are stored.

CHAR* DevcName; -> DevcName is a variable that has the type CHAR*. It basically is a c string

types are important in C++. You can't have a variable without saying exactly what type it has

[EDIT]
Reader_F->ul_NbRdr may look confusing. It uses the fact that an array can be implicitly converted to a pointer to the first element. You can also write it like so Reader_F[0].ul_NbRdr
[/EDIT]
Last edited on
Topic archived. No new replies allowed.