#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Rochester, NY
    Posts
    21
    Rep Power
    0

    Question .NET framework and the String class


    OK, I'm working on an app in .NET C++ and I have two questions.

    1) Is there any way to make the .NET framework stuff that my app needs part of my binary .exe file? It's kind of annoying how people have to install the .NET framework just to run my app.

    2) I'm passing String objects to a function that is expecting a normal string like "a string" but for some reason it doesn't seem to work. I tried .ToString() and .ToCharArray() but neither of them worked either.

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Brisbane, Australia
    Posts
    50
    Rep Power
    11
    1) theoritically there should be a way.... however if your user does update their windows all the time, they should should have .NET framework installed...



    2) did you do any pointer address operation on the string you passing to your function? it is hard to guess what actually happened with out seeing the actual syntax...

    your function should be able to read the string directly (as if your string is defined as System.String, alia: string)





    --------------------
    EDIT, added for the 1st part (I forgot to give you my solution)
    This is C# way, I have not tried it, so don't expect it to work.
    If you open the property window for the resource library you are using, you will see a property called "Copy Local". Assign true to this property, and that particular library will be output together with your app.
    I have only tried it with something like MSChart, MSWord, never tried with the .NET core, so good luck
    Last edited by oni9; October 17th, 2003 at 08:43 AM.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Rochester, NY
    Posts
    21
    Rep Power
    0
    I declare them in my header file like this:

    String *proxyServer;
    String *proxyPort;

    Then I pass String*'s to this function:

    void curlWorker::SetProxy(String *proxyServerIn, String *proxyPortIn)
    {
    this->useProxy = true;
    this->proxyServer = String::Copy(proxyServerIn);
    this->proxyPort = String::Copy(proxyPortIn);
    }

    Then I try to pass the strings to cURL like this:

    if(this->useProxy)
    {
    curl_easy_setopt(curl, CURLOPT_PROXY, this->proxyServer);
    curl_easy_setopt(curl, CURLOPT_PROXYPORT, this->proxyPort);
    }

    But it doesn't seem to work.

    When I hardcode in values for the proxy like:

    curl_easy_setopt(curl, CURLOPT_PROXY, "proxyserver");
    curl_easy_setopt(curl, CURLOPT_PROXYPORT, this->"8000");

    it does work.

    Any idea what I'm doing wrong? Thanks.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Brisbane, Australia
    Posts
    50
    Rep Power
    11
    I never use C++ .NET (I did VC++ long ago)

    ---------- ignore below
    probably your proxyServer and proxyPort were not defined as (string *)
    ---------- ignore ends


    Code:
    String *proxyServer;
    String *proxyPort;
    
    Then I pass String*'s to this function:
    
    void curlWorker::SetProxy(String *proxyServerIn, String *proxyPortIn)
    {
      this->useProxy = true;
      this->proxyServer = String::Copy(proxyServerIn);
    // try this->proxyServer = proxyServerIn->Clone() instead
      this->proxyPort = String::Copy(proxyPortIn);
    // try this->proxyServer = proxyPortIn->Clone() instead
    }
    Last edited by oni9; October 17th, 2003 at 08:54 AM.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Rochester, NY
    Posts
    21
    Rep Power
    0
    Actually I did that in the header file like:

    String *proxyServer;
    String *proxyPort;

    Well, I'll keep investigating. This is a PITA because I've been stuck on it for like 24 hours
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Location
    Brisbane, Australia
    Posts
    50
    Rep Power
    11
    have you tried '&' operator yet?

    sorry I did not touch C++ for a year now... forgot how to play with pointers... I'm sure it is the memory address pointer problem
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Rochester, NY
    Posts
    21
    Rep Power
    0
    Yeah I'll try playing around with the &.

    I suck at pointers

IMN logo majestic logo threadwatch logo seochat tools logo