I have a path to some folders as a string and using strtok() to break down subfolders separated by , delimiter. Issue is when its printing in a TreeControl view (runs successfully) but its printing an extra blank folder (dotted/line space) for what looks like a future folder maybe? how do I get rid of that blank folder and only show the 2 folders (Pop, Country). I tried adding picture but not working so here is what it looks like on the treeview:
->/Desktop/Songs
->..... this is where the blank is being inserted
->Pop
->Country
Code:
HTREEITEM hItem;
HTREEITEM hsubItem;
char line[] = "/Desktop/Songs,Pop,Country" ;
char* dir= strtok(line,",");
printf("%s\n", dir);
hItem= treeview.InsertItem(dir); //add to a tree control as the root path or directory
while (dir!= NULL)
{
dir= strtok(NULL,",");
printf("%s\n", dir);
hsubItem = treeview.InsertItem(dir, hItem); //add Pop Country below the first item
}