Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #6063
| From | ol.sc@web.de (Oliver Schmidt) |
|---|---|
| Newsgroups | comp.sys.apple2.programmer |
| Subject | Re: cc65: file I/O on external drive? |
| Date | 2023-08-10 20:08 +0000 |
| Message-ID | <ub3g31$cajg$1@solani.org> (permalink) |
| References | <20230810153128.037b45e2@laptop-sigfox> <mmphosis-1691679708@macgui.com> <20230810180315.19b34c79@laptop-sigfox> <20230810182225.7571b259@laptop-sigfox> |
Hi Colin,
>This is in fact extremely easy: you just fopen("/PREFIX/FILENAME") and
>it finds the correct drive all by itself :)
Yes, ProDOS is about volumes and paths, not about slots and drives.
However, if you have to access a certain drive then the way to do it
is this:
1. Calculate the device number according to the formula
device = slot + (drive - 1) * 8
(https://cc65.github.io/doc/apple2.html#ss9)
2. Call getdevicedir() with the device from 1.
(https://cc65.github.io/doc/funcref.html#ss3.135)
3. Construct an absolute path from 2. or call chdir() with 2.
If you want to return where you've been before calling chdir(), you
can call getcwd() before chdir().
In general, you might want to have a look at
https://github.com/cc65/cc65/blob/master/samples/enumdevdir.c
Regards,
Oliver
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
cc65: file I/O on external drive? Colin Leroy-Mira <colin@colino.net> - 2023-08-10 15:31 +0200
Re: cc65: file I/O on external drive? mmphosis <mmphosis@macgui.com> - 2023-08-10 15:01 +0000
Re: cc65: file I/O on external drive? Colin Leroy-Mira <colin@colino.net> - 2023-08-10 18:03 +0200
Re: cc65: file I/O on external drive? Colin Leroy-Mira <colin@colino.net> - 2023-08-10 18:22 +0200
Re: cc65: file I/O on external drive? ol.sc@web.de (Oliver Schmidt) - 2023-08-10 20:08 +0000
Re: cc65: file I/O on external drive? Colin Leroy-Mira <colin@colino.net> - 2023-08-11 12:07 +0200
Re: cc65: file I/O on external drive? Oliver Schmidt <ol.sc@web.de> - 2023-08-11 11:31 +0000
csiph-web