warning: assignment makes pointer from integer without a cast
Code:
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
int main(int argc,char **argv)
{
char ch[1000];
int max = 1000;
int i = 0;
DIR *dip;
struct dirent *dit;
FILE *fp;
char* result = NULL;
char delims[] = {'(', '.' , ')'};
/* read character by character from stdin */
if((dip = opendir(argv[1])) == NULL){
perror("opendir");
return 0;
}
while((dit = readdir(dip)) != NULL){
fp = fopen(dit->d_name, "r");
printf("%s\n",dit->d_name);
while (fgets(ch, sizeof(ch),fp ) != NULL){
result = strtok( ch, delims );
while( result != NULL ) {
printf( "result is \"%s\"\n", result );
result = strtok( NULL, delims );
}
//printf("%s ",ch);
i++;
}
}
printf("\n");
return 0;
}
Okay i know this is common but I get that warning every time i use the strtok command I is there a reason i dont even using integers so..... im not sure if its "result" thats the problem