File

From OpenCA Labs WiKi

The File URL

This is the simples URL format. The syntax is as follows:

   [file://]path

where path is the full path to the resource on the local filesystem. Here it is an example on how to get data from such a URL:

#include <libpki/pki.h>

int main() {

   PKI_MEM_STACK *sk = NULL;
   char *url_s = "file://data/certs/mycert.pem";

   if(( sk = URL_get_data( url_s, 0 )) == NULL ) {
      printf("ERROR, can not load %s!\n", url_s );
   }

   printf("Got %d objects!\n", PKI_STACK_MEM_elements(sk));
   return(0);
}