delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/11/18:03:10

Date: Tue, 11 Aug 92 13:25:28 PDT
From: Peter Crowley <pcrowley AT qdeck DOT com>
To: kunst AT prl DOT philips DOT nl, djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: how to use MS-DOS wild cards

Here is a start:
#include <stdio.h>
#include <dirent.h>

main(argc, argv)
int argc;
char **argv;
{
    char *dirname;
    DIR  *odir;
    struct dirent *dp;

    if (argc == 1) dirname = ".";
    else dirname =argv[1];

    if ((odir = opendir(dirname))) {
        dp = readdir(odir);
        while (dp) {
           printf("%s\n",dp->d_name);
           dp = readdir(odir);
        }
        closedir(odir);
    } else
        printf("Could not open directory %s\n",dirname);
}

Peter Crowley


- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019