I don't know much about the +3 driver so I'm forwarding this here. Maybe a response can also be copied to WOS: http://www.worldofspectrum.org/forums/s ... hp?t=20781So I have this very simple program, and it doesn't want to open a file for writing:
It is compiled from a Makefile, and the build output looks like this:Code: Select all
#include <stdio.h> #include <stdlib.h> void main() { FILE *stream; printf("\x1B[2JTest of file IO\n"); stream=fopen("foo", "w"); if(!stream) { printf("Failed\n"); return; } fprintf(stream, "foo\n"); fclose(stream); }
There are no compile or link errors. However, fopen always returns NULL - I can give it the filename "m:foo", "a:foo" or simply "foo". The disk doesn't spin, RAMdisk doesn't get written. I've not found an equivalent to 'perror' or a global errno, so the only thing I see is fopen returning NULL.Code: Select all
zcc +zxansi -vn -O2 -preserve -DPLUS3 -c -o main.o main.c zcc +zxansi -vn -O2 -preserve -DPLUS3 -o test.bin main.o -lp3
What am I missing here?
+3 Disk File I/O
+3 Disk File I/O
A message posted at WOS:
I've managed to forget my Wos username and password again....
I've just tried this out and it all looks ok, the file is written without problems and it contains what it's meant to.
Guess a copy of the binary and a .map file is probably useful to see what's going on - the binary should be about 4300 bytes in length if it's got the +3 file io linked in.
I've just tried this out and it all looks ok, the file is written without problems and it contains what it's meant to.
Guess a copy of the binary and a .map file is probably useful to see what's going on - the binary should be about 4300 bytes in length if it's got the +3 file io linked in.
Just to wrap this up here, the stack was being swapped out due to a lack of a clear 32767 before running the binary.
Wos post was here: http://www.worldofspectrum.org/forums/s ... hp?t=20781
Wos post was here: http://www.worldofspectrum.org/forums/s ... hp?t=20781
Another issue with the +3 file i/o at WOS:
http://www.worldofspectrum.org/forums/s ... hp?t=28816
This time with opening a file for reading with fopen("scr","r"). It's looking like z88dk is opening the file with an exclusive file lock (I didn't even know +3 DOS could do this :-P ) and not all emulators support that feature so some emulators are returning NULL. I'm thinking non-exclusive file access makes more sense and file locking should be specified some other way.
http://www.worldofspectrum.org/forums/s ... hp?t=28816
This time with opening a file for reading with fopen("scr","r"). It's looking like z88dk is opening the file with an exclusive file lock (I didn't even know +3 DOS could do this :-P ) and not all emulators support that feature so some emulators are returning NULL. I'm thinking non-exclusive file access makes more sense and file locking should be specified some other way.