Re: [cc65] Filenames for POSIX functins on CBM targets

From: Oliver Schmidt <ol.sc1web.de>
Date: 2012-08-10 19:07:09
Hi,

> btw, to make clear what i mean.... it should always be possible to retrieve a
> filename by readdir, and then opening the file by fopen using the exact string
> returned by readdir.

Generally this isn't the case on any OS I know of.

> that pretty much rules out any solution that requires to
> specify the drive and/or device number. and it also rules out any solution
> that can not deal with whatever is a valid filename.

I can't follow you at all here. All readir() implementations I know of
return the filename only, no relative path, no absolute path.

So what you describe above works this way _only_ if the directory read
is ".". The sample 'multidemo' does exactly this.

But if you read any other directory then it is your task to either
- prepend the directory name you read to the file name you want to
open (and a path delimiter)
or
- chdir() to the directory before opening the file

I think of something like
- opendir("/usr/var/mystuff")
- readdir() returns "thisfile"
- fopen("/usr/var/mystuff/thisfile")

With my proposal the same would be true for the C64
- opendir("8:0:")
- readir() returns "thisfile"
- fopen("8:0:thisfile")

The only issue is the missing delimiter. If the majority here likes it
better I could as well live with opendir()/chdir()/getcwd() omiting
the last ':' like in "8:0" so that the colon can be defined as
delimiter.

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 Fri Aug 10 19:07:22 2012

This archive was generated by hypermail 2.1.8 : 2012-08-10 19:07:25 CEST