CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2004
    Posts
    11

    Question 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...

  2. #2
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    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?
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  3. #3
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: simple nested loop unable to compile in vc.net

    I had read your post, why did you delete it?
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  4. #4
    Join Date
    Dec 2004
    Posts
    11

    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.

  5. #5
    Join Date
    Dec 2004
    Posts
    11

    Re: simple nested loop unable to compile in vc.net

    it had some post icon inserted by itself

  6. #6
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    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!
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  7. #7
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    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...
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  8. #8
    Join Date
    Dec 2004
    Posts
    11

    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.

  9. #9
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    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.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  10. #10
    Join Date
    Dec 2004
    Posts
    11

    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);
    }
    }

  11. #11
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: simple nested loop unable to compile in vc.net

    Can you post the exact line of error... Or entire file, if possible.

    Regards.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  12. #12
    Andy Tacker is offline More than "Just Another Member"
    Join Date
    Jun 2001
    Location
    55°50' N 37°39' E
    Posts
    1,503

    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
  •  





Click Here to Expand Forum to Full Width

Featured