Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!vrdxhq!verdix!qtc!ed
From: ed@qtc.UUCP (Ed Lisle)
Newsgroups: comp.sys.ibm.pc
Subject: Need help (Turbo C program)
Message-ID: <306@qtc.UUCP>
Date: Thu, 16-Jul-87 01:25:14 EDT
Article-I.D.: qtc.306
Posted: Thu Jul 16 01:25:14 1987
Date-Received: Sat, 18-Jul-87 13:28:40 EDT
Organization: Quantitative Technology Corp., Beaverton, OR
Lines: 51

Ok - I need some help in the following Turbo C program.  All I want to 
do is a directory and save the filenames away to be played with later on.
Here it is.  Thanks in advanced.

What happens is "file_list" contains garbage.
-------------------------------------------------------------------------

#include 
#include  

#define FILE_LEN 13

main(argc, argv)
int argc;
char *argv[];
{
    int i;
    int done;
    int count;
    char pattern[80];
    char file_list[FILE_LEN*50];
    struct ffblk fcb;

	if (argc != 2)
		strcpy(pattern, "*.*");
	else
		strcpy(pattern, argv[1]);

	count = 0;
	done  = findfirst(pattern, &fcb, 0);
	while (!done) {
		strncat( &file_list[count*FILE_LEN],
			 fcb.ff_name,
			 FILE_LEN );
		++count;
		done = findnext(&fcb);
	} /* End while */

	printf("count: %d\n", count);
	for (i=0; i