Whenever I try to use strcpy on a struct member (which is a static char array) and the d_name attribute of a dirent structure (used for reading a directory), my program doesn't get passed that point. I don't get any errors or warnings, it just doesn't get passed it. The struct is initialized globally.
typedef struct SearchArgs
{
char inputFile[MAXDIRPATH];
char word[MAXKEYWORD];
Buffer * buffer;
}SearchArgs;
SearchArgs * args;//arguments for seachFile
...
dir = opendir(nextItem.path);//opens the next directory
...
dp = readdir(dir);
...
printf("dname: %s\n", dp->d_name);//prints
printf("args->inputFile: %s\n", args->inputFile);//prints
strcpy(args->inputFile, dp->d_name);//not getting passed this point
printf("TEST1\n");//doesn't print
Output:
dname: file2.txt
args->inputFile: (null)
Any insight is much appreciated.