Re: [cc65] C64 POSIX dirent stuff actually working?

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-08-12 13:16:10
Hi,

Wow - CBM disk i/o is really cool - at least for the naive cc65 POSIX
i/o function user (like me)...

The following program...

====================
#include <stdio.h>
#include <fcntl.h>
#include <dirent.h>

void main(void)
{
    DIR* dir;
    struct dirent* ent;

    dir = opendir(".");
    while (ent = readdir(dir)) {
        int f;

        printf("%s", ent->d_name);

        if (!_DE_ISREG (ent->d_type)) {
            printf(" skipped\n");
            continue;
        }

        if (f = open(ent->d_name, O_RDONLY)) {
            printf(" opened\n");
            close(f);
        }
    }
    closedir(dir);
}
====================

...stops reading directory entries after the 8. entry (incl. the disk
label). The output for a disk called 'test' with i.e. 9 files called
'test[1-9]' looks like this:

====================
run
test             skipped
test1 opened
test2 opened
test3 opened
test4 opened
test5 opened
test6 opened
test7 opened

ready.
====================

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Aug 12 13:16:24 2012

This archive was generated by hypermail 2.1.8 : 2012-08-12 13:16:27 CEST