Published 27 June 2019

Examples: C++: Boilerplate

Project:

https://github.com/CREDITSCOM/examples

Branch:

https://github.com/CREDITSCOM/examples/tree/master/API/CreditsCPlusPlusDemoCMake

 

In order to further illustrate the use of Credits API, let’s create a boilerplate.

 

// Connecting Thrift library

#include <thrift/stdcxx.h>

#include <thrift/transport/TSocket.h>

#include <thrift/transport/TBufferTransports.h>

#include <thrift/protocol/TBinaryProtocol.h>

 

// API implementation with C++

#include "api/API.h"

#include "keys.h"

#include "client.h"

 

//Connecting namespaces

using namespace std;

using namespace apache::thrift::transport;

using namespace apache::thrift::protocol;

using namespace api;

using namespace general;

 

int main(int argc, char* argv[])

{

  if (argc != 6)

   {

      cout << "Usage: main.exe NodeIpAddress NodePort YourPublicKey YourPrivateKey TargetPublicKey" << std::endl;

      return 1;

   }

 

   cout << "Credits API Demo C++" << endl;

}



Votes 0, average rating 0

Contents