So I am trying to list all the files in a directory except for "." and "..", it seems simple enough. So I try this test program:

Code:
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>

int main(int argc, char ** argv){
	DIR *dp;
	struct dirent *ep;
	dp = opendir (".");
	if (dp != 0) {
		while (ep = readdir(dp)) {
			if (ep->d_name == ".." || ep->d_name == ".") continue;
			printf("%s\n", ep->d_name);
		}
		(void) closedir (dp);
	}
}
But it doesn't work! ".." and "." are still listed!

What is wrong with my program?