while (!feof(myfile))
{
fgets(buffer,2500,myfile);
printf("%s",buffer);
}
fclose(myfile);
return 0;
}
1.in this code i am accessing a folder to read a text file. this test0 folder is only 1 folder of the 1500 folders i have to read in which i have to open and compare 1500 txt files which are in test0... test1500. i can only access the text file through path( this is the only way i know to access the text file placed in a folder).please can someone tell how can i access 1500 folders in a loop or some other way. a code snippet would be really appreciated.
2.for each of 1500 text files and i have to compare the strings in them such that if two files have similar strings then i keep only 1 of it in a buffer and compare it with the next file. if theses two have some strings different then i will unite them.and remember the folder name e.g test 19, test 100 in a separate file.if somebody has an idea abt it please help me.
in problem 2 i want to mention that
for test 0 i have a text file,stmt.txt, it has certain number of strings in it.(actually those are statements that test0 covers, but they might not be all the statement that an adequate test case would cover
for test1 i have a text file stmt.txt, it has again a list of statements covered by test 1. those statements may or maynot be same as the ones covered in test 0. or some of the statements could be same and some could be different.
similarly in 1500 test folders i have 1500 files.
i have to compare all the files and save only the names of the test folders in a separate file whose strings are totally different or partially different, which is my output file.
i know this might not be right to ask this, but if i can have a sample code or snippet for problem 1 and 2, i will be really obliged because i am not a really good programmer and i have really less time to finish this task.
i searched for variable paths but that seemed really confusing a document would be appreciated.
"Sounds like a problem for a script. Why would you want to do this in C? "
Actually i switched from electrical to computer science, so i dont know any other language except c, i am planning to learn some languages, but right now the language which i have learnt is only C. this is the reason i am having trouble in programming.