I’m reading this text from a file:
file1: file2,file3,file4
file10: testfile.h
file1: file9
and splitting it
while(fscanf(fp,"%[^:]: %s",map[i].name, map[i].filesNeeded) == 2)
{
printf("%s %s",map[i].name, map[i].filesNeeded);
i++;
}
The problem is that the second and third variables are saved with leading newline characters:
Details:{name = "\\nfile10", '\\000' <repeats 56 times>, filesNeeded = "testfile.h", '\\000' <repeat
How can i save it without the leading newline characters?
add space for
" %[^:]: %s "the space in the scanf absorbs the space characters, tabulation characters, new line characters