here is the function...
Code:
char *getAddressbookDir(char tbIni[]){
char line[SIZE], tLine[SIZE], *pathAb, *mDir, *sDir;
int lnLen;
FILE *ifp;
ifp = fopen(tbIni, "r");
if(ifp == NULL){
printf("\"%s\" could not be opened", tbIni);
exit(EXIT_FAILURE);
}
while (fgets(line, sizeof(line), ifp) != NULL){
//remove the new line char
if (line[strlen(line)-1] == '\n'){
line[strlen(line)-1] = '\0';
}
strcpy(tLine, line);
lnLen = strlen(line);
if(lnLen > 1 && strncmp(line, "Path", 4) == 0){
strtok(tLine, "=");
mDir = strtok(NULL, "=");
}//end if (lnLen > 1...
}//end while
//pathAb has something like "Profiles/p41ad5yo.default"
//we need something like "Profiles\p41ad5yo.default"
strtok(mDir, "/");
sDir = strtok(NULL, "/");
//printf("%s\n", sDir);
//pathAb = mDir;
//strcat(pathAb, "\\");
//strcat(pathAb, sDir);
return pathAb;
}