I'm trying to work out some inconsistent behavior in my app across platforms. On FreeBSD, seekdir() doesn't seem to behave as I expect it to. Here's a short program that demonstrates my confusion:
#include <sys/types.h> #include <sys/stat.h> #include <dirent.h> int main() { DIR* dirp; off_t pos; struct dirent* ent; dirp = opendir("."); if (!dirp) perror("opendir"); ent = readdir(dirp); if (!ent) perror("readdir"); pos = telldir(dirp); if (pos == -1) perror("telldir"); ent = readdir(dirp); if (!ent) perror("readdir 2"); seekdir(dirp, pos); printf("First telldir:%d\nSecond telldir:%d\n", pos, telldir(dirp)); return 0; } On other platforms, the first and second telldir() return the same value. On the two FreeBSD machines I've tried it on, the first telldir() returns 1 and the second returns 0. Can anyone explain this? Thanks in advance, Jp _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"