Decoding quoted printable strings in C++

How can I decode quoted printable strings in C++ with your NetCode control?

Date Entered: 12/14/2000    Last Updated: 06/04/2004

Here is a sample that does what you want:

#include "../../../include/ipworks.h"
#include 
#include 
#include 

void main(int argc, char **argv) {

  NetCode *p = new NetCode();

	char *pData = "some © data...";
	char *pResult;
	unsigned int lenResult;

  int ret_code = p->SetDecodedData(pData, strlen(pData));
  if (ret_code) goto done;

  ret_code = p->SetFormat(2); //format QP
  if (ret_code) goto done;

  ret_code = p->EncodeToSTring();
  if (ret_code) goto done;

  ret_code = p->GetEncodedData(pResult, lenResult);
  if (ret_code) goto done;

	printf("Decoded data: %s\n", pData);
	printf("Length of encoded data: %d\n", lenResult);
	printf("Encoded data: ");
	fwrite(pResult, 1, lenResult, stdout);
	printf("\n");


done:
  if (ret_code) {
    fprintf(stderr, "error: %d", ret_code);
    if (p->GetLastError())
      fprintf(stderr, " (%s)", p->GetLastError());
    fprintf(stderr, "\nexiting...\n");
    exit(1);
  }

	printf("press any key to continue...");
	getchar();

  delete p;
}


We appreciate your feedback.  If you have any questions, comments, or suggestions about this entry please contact our support team at kb@nsoftware.com.