what should it do on repeats, if a includes b included c includes a?
some of those cases will make it loop forever, and others may just pull the same file in many times.
generally speaking, though, if you want it backwards:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
void RecFile(char* filename)
{
///open file, if that worked, read it, ...
for(all the lines in the file)
{
if(strstr(fileline, "import")
{
//look deeper, verify pattern, check for multiple patterns on same line
if(matched)
{
RecFile(extracted_string);
print(extracted_string);
}
}
}
}
|
is that the order you want, though?
if a includes b and c, do you want b,c, a?
and if b includes d, .. d,b,c,a ?
there may be additional rules if you want some other order than this.
also the first file time you run it, its with a valid starter file, right? so here would run it with recfile("a.txt") ? That is what I assumed.