Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #6063

Re: cc65: file I/O on external drive?

Path csiph.com!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From ol.sc@web.de (Oliver Schmidt)
Newsgroups comp.sys.apple2.programmer
Subject Re: cc65: file I/O on external drive?
Date Thu, 10 Aug 2023 20:08:01 GMT
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>
Injection-Date Thu, 10 Aug 2023 20:08:01 -0000 (UTC)
Injection-Info solani.org; logging-data="404080"; mail-complaints-to="abuse@news.solani.org"
Cancel-Lock sha1:SFMAEAW7qtsXazawiCxE1sVQG8w=
X-Newsreader Forte Free Agent 1.21/32.243
X-User-ID eJwFwYERADAEBLCVqvq8cXDsP0ITqIm1P4M9LNar4Js6iD5Ur94cn8wlw3iLEkTM6biY0g8v1xGC
Xref csiph.com comp.sys.apple2.programmer:6063

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar


Thread

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