Date: Tue, 8 Feb 1994 14:12:13 +0100 From: Gilles Guyot To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Pb. while reading directories Hello, I've written a procedure which lists the files in the current directory but met a problem : when the current directory have some sub-directory the procedure stop and the message "Segmentation violation pointer" is printed. The same code run well under UNIX system so I don't understand where the problem come from ( I'm using DJGPP 1.10 whith a 386 SX under MS-DOS 5.0 ) I've included some of the code below : /*------------------------------------------- #include #include void List_file() { DIR *dirp; FILE *pf; struct dirent *dp; char nom_fichier[80],ligne[80]; dirp = opendir("."); for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) { --> stop at this line: sprintf(nom_fichier,"%s",dp->d_name); if (nom_fichier[0]!='.') { pf = fopen(nom_fichier,"r"); fscanf(pf,"%s",ligne); .... /*---------------------------------------------- Thanks in advance for any help. Gilles GUYOT ( gguyot AT dedale DOT inria DOT fr )