I am trying to split my actual key on dot and then extract all the fields after splitting it on dot.
My key would look like something this -
t26.example.1136580077.colox
Below is the code I have which I was in the impression, it should work fine. But somehow whenever I am compiling this code, I always get -
 error: âstrtok_sâ was not declared in this scope
Below is my code
if(key) {
    vector<string> res;
    char* p;
    char* totken = strtok_s(key, ".", &p);
    while(totken != NULL)
    {
        res.push_back(totken);
        totken = strtok_s(NULL, ".", &p);
    }
    string field1 = res[0]; // this should be t26
    string field2 = res[1]; // this should be example
    uint64_t field3 = atoi(res[2].c_str()); // this should be 1136580077
    string field4 = res[3]; // this should be colox
    cout<<field1<<" "<<field2<<" "<<field3<<" "<<field4<<endl;
}         
I am running Ubuntu 12.04 and g++ version is -
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Any idea what wrong I am doing? And if there is any better way of doing it as well, then I am open to that suggestion as well. I am in the impression that using strtok_s will be more efficient and thread safe as well.