I'm fairly new to C
and am starting to learn header files. Whilst using my header I'm getting an error saying invalid type argument of '->' (have struct dirent)
. I don't understand what this means, I read here that the second argument to ->
must be a pointer, so I tried to add a *
to it (ent->*d_name)
however then I get the error unexpected token *
, how can I fix this?
#ifndef UTILIS_H_INCLUDED
#define UTILIS_H_INCLUDED "utilis.h"
#include <stdio.h>
#include <dirent.h>
char *connect(const char *pattern)
{
struct dirent ent;
char *d_name;
DIR *mgt = opendir("\\\\example\\windows7apps");
while ((ent = readdir(mgt)) != pattern)
{
puts(ent->d_name);
}
}
#endif