38 lines
724 B
C++
38 lines
724 B
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <cstdlib>
|
|
#include <cstring>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#define MAX_FILE_LENGTH 200000
|
|
|
|
class WriterMemoryClass
|
|
{
|
|
public:
|
|
|
|
// Callback must be declared static, otherwise it won't link...
|
|
size_t WriteMemoryCallback(char* ptr, size_t size, size_t nmemb)
|
|
{
|
|
str_pBuffer.erase();
|
|
str_pBuffer = std::string(ptr);
|
|
|
|
return str_pBuffer.size();
|
|
};
|
|
|
|
std::string getResponse()
|
|
{
|
|
// return std::string(m_pBuffer);
|
|
return str_pBuffer;
|
|
}
|
|
|
|
void print()
|
|
{
|
|
std::cout << "Size: " << str_pBuffer.size() << std::endl;
|
|
std::cout << "Content: " << std::endl << str_pBuffer << std::endl;
|
|
}
|
|
|
|
// Public member vars
|
|
private:
|
|
std::string str_pBuffer;
|
|
}; |