|
-
December 3rd, 2004, 12:03 AM
#1
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...
-
December 3rd, 2004, 08:41 AM
#2
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?
-
December 9th, 2004, 07:35 AM
#3
Re: simple nested loop unable to compile in vc.net
I had read your post, why did you delete it?
-
December 9th, 2004, 07:37 AM
#4
Re: simple nested loop unable to compile in vc.net
the exact error was:
cannot perform pointer arithmetics with pointer __gc: nsoftware::IPWorks: ns::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.
-
December 9th, 2004, 07:40 AM
#5
Re: simple nested loop unable to compile in vc.net
it had some post icon inserted by itself
-
December 9th, 2004, 07:42 AM
#6
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!
-
December 9th, 2004, 07:45 AM
#7
Re: simple nested loop unable to compile in vc.net
 Originally Posted by priyankasaini
it had some post icon inserted by itself
Couldnt get this...
-
December 9th, 2004, 07:52 AM
#8
Re: simple nested loop unable to compile in vc.net
my reply included some 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.
-
December 9th, 2004, 07:58 AM
#9
Re: simple nested loop unable to compile in vc.net
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.
-
December 9th, 2004, 08:07 AM
#10
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);
}
}
-
December 9th, 2004, 08:18 AM
#11
Re: simple nested loop unable to compile in vc.net
Can you post the exact line of error... Or entire file, if possible.
Regards.
-
December 15th, 2004, 08:38 AM
#12
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]);
}
}
If you think you CAN, you can, If you think you CAN'T, you are probably right.
Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|