Files
lib-privatebin/example/example.cpp

45 lines
1.5 KiB
C++

#include "privatebinapi.h"
#include <iostream>
#include <cstring>
int main() {
std::cout << "PrivateBin API C++ DLL Example" << std::endl;
std::cout << "===============================" << std::endl;
// Example of how to use the API
char* paste_url = nullptr;
char* delete_token = nullptr;
// Note: This is a demonstration only. In a real application,
// you would use actual server URLs and handle errors appropriately.
/*
int result = create_paste(
"https://privatebin.net", // Server URL
"Hello, PrivateBin!", // Content
nullptr, // No password
"1hour", // Expire in 1 hour
"plaintext", // Plain text format
0, // Don't burn after reading
0, // No discussion
&paste_url, // Output: paste URL
&delete_token // Output: delete token
);
if (result == 0) {
std::cout << "Paste created successfully!" << std::endl;
std::cout << "URL: " << paste_url << std::endl;
std::cout << "Delete token: " << delete_token << std::endl;
// Clean up allocated memory
free_string(paste_url);
free_string(delete_token);
} else {
std::cout << "Failed to create paste. Error code: " << result << std::endl;
}
*/
std::cout << "Example completed." << std::endl;
return 0;
}