I am using and understanding strtok for a while but this time it is giving unexpected error. I can't figure out what's wrong. Please help. I am using Visual Studio on Windows 10.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[])
{
char* filepath = "C:\\Users\\RAKESH\\source\\repos\\TESTING\\log.c";
char* filename = strtok(filepath, "\\");
while (filename != NULL)
{
filename = strtok(NULL, "\\");
}
printf("%s\n", filename);
return 0;
}