Begin Editing a Document File in C/C++
If you need to delete pages or insert a table into an online document, it can be a bit tricky to accomplish manually. In this brief tutorial, we will show you how to upload a document to Cloudmersive to begin a series of editing operations. The editing URL that is generated from the API function is temporary and will automatically expire from the in-memory chase after 30 minutes, ensuring that your information is not retained.
To begin the operation in C/C++, we must first install libcurl into the project:
libcurl/7.75.0
Once the installation s complete, we can call the Begin Editing function with the following API:
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.cloudmersive.com/convert/edit/begin-editing");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: multipart/form-data");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_mime *mime;
curl_mimepart *part;
mime = curl_mime_init(curl);
part = curl_mime_addpart(mime);
curl_mime_name(part, "inputFile");
curl_mime_filedata(part, "/path/to/file");
curl_easy_setopt(curl, CURLOPT_MIMEPOST, mime);
res = curl_easy_perform(curl);
curl_mime_free(mime);
}
curl_easy_cleanup(curl);
And that’s it — your editing URL will be ready for use in no time at all!