simple nested loop unable to compile in vc.net
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...
Re: simple nested loop unable to compile in vc.net
Please list out the errors in your next post, so that we could move further. I mean what exact errors are there?
Re: simple nested loop unable to compile in vc.net
I had read your post, why did you delete it? :rolleyes:
Re: simple nested loop unable to compile in vc.net
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.
Re: simple nested loop unable to compile in vc.net
it had some post icon inserted by itself
Re: simple nested loop unable to compile in vc.net
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!
Re: simple nested loop unable to compile in vc.net
Quote:
Originally Posted by priyankasaini
it had some post icon inserted by itself
Couldnt get this... :confused: :confused:
Re: simple nested loop unable to compile in vc.net
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.
Re: simple nested loop unable to compile in vc.net
Quote:
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..!
Quote:
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.
Re: simple nested loop unable to compile in vc.net
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);
}
}
Re: simple nested loop unable to compile in vc.net
Can you post the exact line of error... Or entire file, if possible.
Regards.
Re: simple nested loop unable to compile in vc.net
just a glance shows me this error...
Code:
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]);
}
}