home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!b63519.STUDENT.CWRU.Edu!dpn2
- From: dpn2@po.CWRU.Edu (Damien P. Neil)
- Newsgroups: comp.programming
- Subject: Re: Help!
- Date: Thu, 19 Nov 1992 00:59:02 GMT
- Organization: Case Western Reserve University
- Lines: 33
- Message-ID: <dpn2.112.722134742@po.CWRU.Edu>
- References: <1992Nov19.000103.27156@mnemosyne.cs.du.edu>
- NNTP-Posting-Host: b63519.student.cwru.edu
-
- In article <1992Nov19.000103.27156@mnemosyne.cs.du.edu> nogurtso@nyx.cs.du.edu (Nick Ogurtsov) writes:
- >I have a problem. I'm new in C language, so can anyone help me?
- >Could anyone write a piece of C code to show how to use findfirst()?
- >
- >Could anyone show me how to display found file name on the screen? (from
- > ffblk.fname).
-
- Are you using Borland/Turbo C, by any chance? If so, there is some good
- example code in the help system. Here it is: (Borland won't get mad at me
- for posting an insignificant fragment like this, will they?)
-
- /* findfirst and findnext example */
-
- #include <stdio.h>
- #include <dir.h>
-
- int main(void)
- {
- struct ffblk ffblk;
- int done;
- printf("Directory listing of *.*\n");
- done = findfirst("*.*",&ffblk,0);
- while (!done)
- {
- printf(" %s\n", ffblk.ff_name);
- done = findnext(&ffblk);
- }
-
- return 0;
- }
- +-------------+------------------+---------------------------------+
- | Damien Neil | dpn2@po.cwru.edu | Case Western Reserve University |
- +-------------+------------------+---------------------------------+
-