You have to remember that fgetc() will also receive newline characters as well as numbers
the little things kill me everytime................
heres version 2
Code:
#include <stdio.h>
int getfile(char *file) {
FILE *data;
data = fopen(file, "r");
char current[2];
int last = 0;
if(data == NULL) {
perror(NULL);
return 1;
} else {
while( (fscanf(data, "%s", current)) != EOF ) {
if(current[0] != last) {
printf("%c\n", current[0]);
last = current[0];
}
}
}
fclose(data);
return 0;
}
int main (){
char filename[256];
printf("Give file name:");
scanf("%s",filename);
getfile(filename);
return 0;
}