1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
FILE *fr;
int depth,l,w,q;
char material[100],code[10];
char index[100]; //Not used at this stage - redundant?
char directory[]=".\\test\\";
char file[25];//not used - redundant?
char str[50]; //maybe make this larger
struct dirent *dp;
DIR *dfd = opendir(directory);
if(dfd != NULL)
{
while((dp = readdir(dfd)) != NULL)
{
strcpy(str,directory);
//Don't bother with the . or .. filenames
if(strcmpi(dp->d_name,".") == 0 || strcmpi(dp->d_name,"..")==0)
continue;
strcat(str,dp->d_name);
printf("%s\n",str);
fr=fopen(str,"r");
fscanf(fr,"%[^;];%d;%d;%d;%d;%s",&material,&depth,&l,&w,&q,&code);
printf("%s %d %d %d %d %s\n",material,depth,l,w,q,code);
//printf("%s\n", dp->d_name);
}
closedir(dfd);
}
fclose(fr);
| |