error: cannot convert ‘std::string’ to ‘X509*’ for argument ‘1’ to ‘EVP_PKEY* X509_get_pubkey(X509*)’
===

I want to verify if the certificate is valid in its format, so i wrote this code but it seems that there is an error

    if (validConfigFile()) {    
        INIReader reader(CONFIG_FILE);
        string certFile= reader.Get("Server", "cert-file", "None");
        if (certFile == "None") {
            syslog(LOG_ERR, "cert-file in configuration file is not properly adjusted");
            exit(EXIT_FAILURE); }
        else {
            std::string fileName(certFile);
            ifstream fin(fileName.c_str());
            if(fin.fail()) {
                syslog(LOG_ERR, "cert-file not found in its file path");
                exit(EXIT_FAILURE); }
            else {
                OpenSSL_add_all_digests();
                SSL_CTX *sslctx = SSL_CTX_new(SSLv23_server_method());
                SSL_CTX_use_certificate_file(sslctx, certFile, SSL_FILETYPE_PEM);
                SSL *ssl = SSL_new(sslctx);
                X509 *CERT = SSL_get_certificate(ssl);
                if (X509_verify(CERT,X509_get_pubkey(CERT)) == -1) {
                    syslog(LOG_ERR, "cert-file not valid");
                    exit(EXIT_FAILURE); }
            }
        }
    }

when compiling i get this error 

    /main.cpp:68: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘2’ to ‘int SSL_CTX_use_certificate_file(SSL_CTX*, const char*, int)’