Thread: Is the below C program is correctly written program to display list all header files?

  1. #1
    Registered User
    Join Date
    Sep 2014
    Posts
    8

    Is the below C program is correctly written program to display list all header files?

    Code:
    #include <stdio.h>
    #include <conio.h>
    #include <dir.h>
    
    
    int main()
    {
       int done;
       struct ffblk a;
       clrscr();
        done = findfirst("c://TCWIN45//INCLUDE//*.h",&a,0);
        while(!done)
        {
            printf("%s\t",a.ff_name);
          done = findnext(&a);
       }
    
    
        getch();
       return 0;
    }

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    More "borrowed" code, huh?

    How about answering this question yourself. Does this program display a list of all header files in the given directory? (I'm assuming you tried to run it.)

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Excepting the obsolete compiler and OS.

    You might see some weird crap as soon as it sees a path component which doesn't match 8.3 notation, or spaces in the filename, or dates past Y2K, or a host of other issues.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 06-02-2013, 09:22 PM
  2. Replies: 13
    Last Post: 05-02-2012, 04:17 PM
  3. have i written this program correctly ?
    By broli86 in forum C Programming
    Replies: 6
    Last Post: 07-20-2008, 03:20 PM
  4. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  5. windows header files not linking correctly
    By skorman00 in forum Windows Programming
    Replies: 2
    Last Post: 04-13-2005, 11:14 AM

Tags for this Thread