'splitting a string using '\0' [closed]

let's say I have a char* ./a.out\0a\0b\0\0. I want to split it and the result to be a char** of value

{
    "./a.out\0",
    "a\0",
    "b\0",
    "\0"
}

I'm using pure c + POSIX but if an answer contains parts of the c++STL I don't mind that, just avoid the memory inefficient ones like std::string



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source