Page 1 of 1
reading files from CD
Posted: Sat Sep 04, 2004 3:31 pm
by PrimeTime
Hello, its me again
I can sucessfully read files from a hard drive, and now i'm working on reading files from the CD drive.
I'm running into a few problems. First, is it possible to use the fileXio library with the cd drive?
Second, I'm trying the following code.
Code: Select all
cdSync(0);
fioOpen("cdrom0:/Test/Test file.txt;1", O_RDONLY);
the open function is returning -1 however. Although I checked the CD and the file is there.
Is there something I'm missing here?
Thanks,
Ryan
Posted: Sat Sep 04, 2004 4:13 pm
by Drakonite
Yeah, fileXio works fine for cds.
Unless I'm mistaken cdrom0 only supports iso level 1 filenames. In other words, the filenames are restricted to 8.3 characters. I _THINK_ the 8.3 filename for "cdrom0:/Test/Test file.txt;1" would end up as "cdrom0:/TEST/TESTFI~1.TXT;1" but don't quote me on that.
Posted: Sat Sep 04, 2004 7:48 pm
by pixel
Well, it depends on the driver which is giving the "cdrom0" filesystem. But I second Drak here: you shouldn't use joliet filesystem.
On a side note:
you may want to
Code: Select all
cdInit(CDVD_INIT_INIT);
cdSetMediaMode(CDVD_MEDIA_MODE_CD);
Posted: Sun Sep 05, 2004 4:05 am
by Drakonite
pixel wrote:Well, it depends on the driver which is giving the "cdrom0" filesystem. But I second Drak here: you shouldn't use joliet filesystem.
Uh... There isn't a lot of choices here ;) And the only way I know of to get support for more than just ISO level 1 doesn't use "cdrom0" as the device name. If there is a third I don't know about, then please by all means let me know.
Posted: Sun Sep 05, 2004 6:02 am
by PrimeTime
Okay, cool.
I'm using fileXio for reading from the hard drive, I just wanted to be able to use both drives without having to change the code as much.
If I want to use the fileXioOpen, Read, Dread, etc... is there any special initialization that I must do? Which device name should I use rather than "cdrom0"?
Thanks,
Ryan
Posted: Sat Sep 11, 2004 3:58 pm
by PrimeTime
Hi,
I found out that my problem was that I didn't have the LIBCDVD v1.15
library. So now that I got that, I am able to read files from the cd using
fioOpen and fioRead. However, I still cannot use fileXioOpen and fileXioRead, these functions return < 0. Does anyone have any suggestions?
Code: Select all
static int fMode = FIO_S_IRUSR | FIO_S_IWUSR | FIO_S_IXUSR | FIO_S_IRGRP | FIO_S_IWGRP | FIO_S_IXGRP | FIO_S_IROTH | FIO_S_IWOTH | FIO_S_IXOTH;
CDVD_Init();
CDVD_FlushCache();
int a;
unsigned char buf[2200+1];
a = fileXioOpen("cdfs:/APPS/PGEN/PGEN.TXT", O_RDONLY, fMode);
printf("opening file returned %d\n", a);
fileXioRead(a, buf, 2200);
printf("read: %s\n", buf);
If i replace the Xio with fio, then everything works.
Posted: Sat Sep 11, 2004 5:55 pm
by TyRaNiD
Well fileXio and fileio do not always share file drivers, I recall libcdvd uses fileio so you must access it via the fio functions. There was supposedly some hack to filexio to hook the original file handler but I guess it doesn't work.