Why not able to apply str.find_last_of( ) on const char * str
<p>I am just trying this code... I want to try to split my path as directory and file. </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;stdio.h&gt;
#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;

using namespace std;

void SplitFilename (const char * str)
{
  size_t found;
  cout &lt;&lt; "Splitting: " &lt;&lt; str &lt;&lt; endl;
  found=str.find_last_of("//");
  cout &lt;&lt; " folder: " &lt;&lt; str.substr(0,found) &lt;&lt; endl;
  cout &lt;&lt; " file: " &lt;&lt; str.substr(found+1) &lt;&lt; endl;
}

int main() {
    char *outFile1 = NULL;
    outFile1 = "//tmp//Softwares//v//vdisk";////tmp//iscsi//target1//lun1
    char* outFile2 = (char*) malloc(strlen(outFile1) + strlen(".meta") + 1);
    strcpy(outFile2,outFile1);
    strcat(outFile2, ".meta");
    cout &lt;&lt; "str2:" &lt;&lt; outFile2 &lt;&lt; "\n";
    SplitFilename (outFile2);

}
</code></pre>

<p>and I am getting these errors </p>

<p>../src/test.cpp:20: error: request for member ‘find_last_of’ in ‘str’, which is of non-class type ‘const char*’
../src/test.cpp:21: error: request for member ‘substr’ in ‘str’, which is of non-class type ‘const char*’
../src/test.cpp:22: error: request for member ‘substr’ in ‘str’, which is of non-class type ‘const char*’</p>

<p>Can anyone tell me how can I make it work by passing a character pointer to the SplitFilename() function.</p>
