Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Escaping things
#include <stdio.h>
#include <string>
#include <string.h>
int main() {
std::string str = "ab:cd:ef";
const char *psz = str.c_str();
for (;;)
const char *pszNext = strpbrk(psz, ":");
if (!pszNext)
printf("%s", psz);
printf("%.*s\\%c", pszNext - psz, psz, *pszNext);
psz = pszNext + 1;
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.