Click to See Complete Forum and Search --> : simple nested loop unable to compile in vc.net
priyankasaini
December 2nd, 2004, 11:03 PM
i am using IP Works v6 liabrary to develop an application related to networking.
it has a dns component with one of the methods as Query. it queries about the domain name servers for a particular domain name and if gets response from default server, returns a 2d array with following identities:
record count --- int --- row counts
record field count --- int --- column count for respective row.
record field type name, record field name, record field value --- string --- the contents of respective columns in a row.
in demo program coded in c#, it is done simply as a 2d array is read with nested for loop counting for each row and respective each column.
in vc++.net, i have coded as:
for(int i =1; i!= VPNdns->RecordCount; i++){
for(int j=1; j!= VPNdns->RecordFieldCount; j++){
VPNdns->FieldIndex = j;
if (j == 1){
VPNtextBox->AppendText(VPNdns->RecordTypeName[i]);
}
VPNtextBox->AppendText(VPNdns->RecordFieldName[i]);
VPNtextBox->AppendText(VPNdns->RecordFieldValue[i]);
}
}
it is compiling and gives error as pointer arithmetics cannot be performed with pointers record field count, type name, name and value.
kindly, help me...
Ajay Vijay
December 3rd, 2004, 07:41 AM
Please list out the errors in your next post, so that we could move further. I mean what exact errors are there?
Ajay Vijay
December 9th, 2004, 06:35 AM
I had read your post, why did you delete it? :rolleyes:
priyankasaini
December 9th, 2004, 06:37 AM
the exact error was:
cannot perform pointer arithmetics with pointer __gc: nsoftware::IPWorks::dns::recordfieldcountindexer __gc*
similar errors wer for recordfieldtypename, recordfieldname and recordfieldvalue.
i consulted to nsoftware suppot also and they have started investigating on it. however, they have recommended me to use c++ edition instead of .net edition.
priyankasaini
December 9th, 2004, 06:40 AM
it had some post icon inserted by itself
Ajay Vijay
December 9th, 2004, 06:42 AM
Is IPWorks and other classes defined by you, or you using .NET classes?
If defined by you, remove __gc from class' definitions, otherwise I would say: there may not be need to do pointer calculations!
Ajay Vijay
December 9th, 2004, 06:45 AM
it had some post icon inserted by itselfCouldnt get this... :confused: :confused:
priyankasaini
December 9th, 2004, 06:52 AM
my reply included some :D like icon when i wrote ": D ". i.e., why i deleted it and replied again.
nsoftware has this IPWorksv6 as a liabrary to include in .net applications. it has components to invoke network related commands - like ping, config, etc.. I am creating objects of these components like we have other window form components like button, etc.
hence, i am not defining the class rather it is included due to the components.
Ajay Vijay
December 9th, 2004, 06:58 AM
my reply included some like icon when i wrote ": D ". i.e., why i deleted it and replied again.Hardly matter for anyone at CodeGuru, since everyone understands it.. :)
Well, why did you delete the post, you could also edit it..!
nsoftware has this IPWorksv6 as a liabrary to include in .net applications. it has components to invoke network related commands - like ping, config, etc.. I am creating objects of these components like we have other window form components like button, etc.As I said earlier, for this condition, that pointer arithmatic would not be needed. There must be some other method (accessor type of) to access the items.
priyankasaini
December 9th, 2004, 07:07 AM
i don't think ... if any other method is available otherwise nsoftware support have suggested me.
the code in c# is as follow and it is working fine.
for (int i = 1; i <= dns1.RecordCount; i++)
{
for (int j = 1; j <= dns1.RecordFieldCount[i]; j++)
{
dns1.FieldIndex = j;
ListViewItem lvi = new ListViewItem();
lvi.UseItemStyleForSubItems = true;
if (j == 1)
{
lvi.Text = dns1.RecordTypeName[i];
}
else
{
lvi.Text = "";
lvi.SubItems.Add("");
}
lvi.SubItems.Add(dns1.RecordFieldCount[i].ToString());//dns1.RecordFieldName[i]);
lvi.SubItems.Add(dns1.RecordFieldValue[i]);
lvwRecords.Items.Add(lvi);
}
}
Ajay Vijay
December 9th, 2004, 07:18 AM
Can you post the exact line of error... Or entire file, if possible.
Regards.
Andy Tacker
December 15th, 2004, 07:38 AM
just a glance shows me this error...
for(int i =1; i!= VPNdns->RecordCount; i++)
{
for(int j=1; j!= VPNdns->RecordFieldCount; j++)
Should be
for(int j=1; j!= VPNdns->RecordFieldCount[i]; j++)
{
VPNdns->FieldIndex = j;
if (j == 1)
{
VPNtextBox->AppendText(VPNdns->RecordTypeName[i]);
}
VPNtextBox->AppendText(VPNdns->RecordFieldName[i]);
VPNtextBox->AppendText(VPNdns->RecordFieldValue[i]);
}
}
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.