Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

plaaaaaaaeassssseeee help me!!! reading a directory 2

Status
Not open for further replies.

oreganr8

Programmer
Aug 6, 2001
7
GB
i really have to hand this work in tommorow and i cant read a directory in DOS/windows!!!!!


(i found some souce code for unix - but header files were different) - need windows/dos!

please pleeease could somone give me a complete source code for reading files in a directory and printing them to the screen ? !

i can read files no problem - but cant read directory!


please help sooon - thankss so much
!
 
at the first #include<windows.h> and use FindFirstFile/FindNextFile. Also, borlands compillers have in dir.h the functions findfirst/findnext. John Fill
1c.bmp


ivfmd@mail.md
 
hey - thanks very much mate - i'll try it!
chheeeerrrss geeeeeezer!
 
As the JohnFill said, u can use findFirst() and findNext() from #include <dos.h>, if u r working under dos environment. u can also take a look at openDir and dirEnt for they are considered to be better than the functions.

Regards,
SwapSawe.
 
hi!
I tried the FindFirstFile function - but i had no documentation on how to use it..! i looked in the libary/header files - and found that they needed 2 inputs..
but what are they ? i tried playing around with pointer and strings but no joy!!

please could one of you helpful fella's give me 5 lines of code showing me how to use the functions ?
thats would be really great -!

thankssssssss!
 
DECLARE A CHAR POINTER AS:

char *command = &quot;dir/b c:\\files >a.txt&quot;;
system(command);

here dir/b is a DOS command to list all files in a dir without description!
&quot;files&quot; is the directory which needs to be read
and &quot;a.txt&quot; is the file in which the output i.e. the names of all the files in the directory will be redirected.

The next statement will execute the DOS command.
We need to read the file a.txt to know the fil;es in the dirctory.
include stdlib.h to execute the command.

Regards
Nam
 
see thread205-117916. I posted there a program with just six function calls. Three of them are yours not familiar. printf you know. So is a very small sample. John Fill
1c.bmp


ivfmd@mail.md
 
hey boys, thanks alot!
i tried both your methods!

JohnFill, i wrote you a little thank you note it the other message post thang!

and thanks Nam for that dos command idea - its so simple! really useful!!

it worked so easily - i thought there must be a catch!

cheeeeeeeeerrrs!!!!!!!!!!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top