From: "A.Appleyard" To: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Date: Thu, 27 Jul 1995 15:14:11 BST Subject: Reading a directory as if it was a file Is there any way in (interrupts usable under Gnu C) to read a directory as if it was a file? I want to write my own program to explore directories. I tried this method in a Gnu C++ program:- unsigned char B[1000000]; int F,i,n; EAX = 0x3d00; EDX = (uns int)"C:\\WORK"; interrupt 21; handle = EAX; /* open file */ EAX = 0x3f00; EBX = handle; ECX = 1000000; EDX = (uns int)B; interrupt 21; n = EAX; /* read up to ECX characters into EDX etseq; n chars actually read */ and then for(i=0;i?' ') as text. But what I got was 18476 bytes of what looked like old djgpp scratch area (assembler labels, gcc call options, binary rhubarb), with no sIgn of names of files that I have under my C:\WORK\. When I repeated with (EDX in the open-the-file call) pointing to the name of a text file, I got the text of the file OK, so my method should work. Surely I should have got the directory as binary a total refusal with an error value returned.