Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. meaing of below code

meaing of below code

Scheduled Pinned Locked Moved Managed C++/CLI
question
3 Posts 3 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 13944139
    wrote on last edited by
    #1

    please tell me what is going on in below code

    if(curl)
    {
    curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
    curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
    curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
    CURLcode res = curl_easy_perform(curl);
    if(res != CURLE_OK)
    {
    curl_easy_cleanup(curl);
    return 0;
    }
    curl_easy_cleanup(curl);
    if(ret.find("Ok"))
    {
    char* r=new char[ret.length()+1];
    strcpy(r,ret.c_str());
    char* p=strtok(r,"|");
    p=strtok(NULL,"|");
    return atoi(p);
    }
    }
    return 1;
    }

    L V 2 Replies Last reply
    0
    • U User 13944139

      please tell me what is going on in below code

      if(curl)
      {
      curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
      curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
      curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
      curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
      CURLcode res = curl_easy_perform(curl);
      if(res != CURLE_OK)
      {
      curl_easy_cleanup(curl);
      return 0;
      }
      curl_easy_cleanup(curl);
      if(ret.find("Ok"))
      {
      char* r=new char[ret.length()+1];
      strcpy(r,ret.c_str());
      char* p=strtok(r,"|");
      p=strtok(NULL,"|");
      return atoi(p);
      }
      }
      return 1;
      }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It appears to use some third party library (curl ?) to obtain text input, find the first token and convert its text to an integer, which it then returns to the caller. I would suggest getting the documentation for the library and studying that.

      1 Reply Last reply
      0
      • U User 13944139

        please tell me what is going on in below code

        if(curl)
        {
        curl_easy_setopt(curl,CURLOPT_URL,url.c_str());
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
        curl_easy_setopt(curl,CURLOPT_WRITEDATA,&ret);
        curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,WriteFunction);
        CURLcode res = curl_easy_perform(curl);
        if(res != CURLE_OK)
        {
        curl_easy_cleanup(curl);
        return 0;
        }
        curl_easy_cleanup(curl);
        if(ret.find("Ok"))
        {
        char* r=new char[ret.length()+1];
        strcpy(r,ret.c_str());
        char* p=strtok(r,"|");
        p=strtok(NULL,"|");
        return atoi(p);
        }
        }
        return 1;
        }

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        See: [curl](https://curl.haxx.se/) [libcurl - curl_easy_setopt()](https://curl.haxx.se/libcurl/c/curl\_easy\_setopt.html) And BTW, you again posted in the wrong forum. This code looks like the native C++.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups