Investigation to follow
Hello,
if it can be useful for you, here is a possible test program (called plus3file.c) I obtained from some existing code of mine:
~~~~
void wtr(const char s)
{
for(; *s!='0';++s)
fputc(s,stdout);
}
int main(void)
{
FILE *f;
char buffer[BUFFERSIZE];
f=fopen("test.dat","w");
if(f==NULL) {
wtr("Can not open file ");
return 1;
}
fputs("SAVEDAWS2.1\n",f);
fputs("this is a test\n",f);
fclose(f);
f=fopen("test.dat","r");
fgets(buffer, BUFFERSIZE, f);
if(f==NULL) {
wtr("Can not open file ");
return 1;
}
if(strcmp(buffer, "SAVEDAWS2.1\n")!=0) {
wtr("Incorrect format ");
fclose(f);
return 2;
}
wtr("Everything was OK.\n");
fclose(f);
return 0;
}
~~~~
The makefile is as follows:
~~~
all:
zcc +zx -clib=ansi -lndos -create-app plus3file.c -subtype=plus3 -o plus3file
~
I compile with no issues, but the file write fails when executing the program on Fuse:

I hope this helps,
D.
I can't spot anything obviously wrong at a first glance, so this one is on me!
EDIT: Of course, I should always take a second glance and use your compile line rather than the one I made myself.
You're adding the option -lndos which is the stub fcntl library, you need to use -lp3 to link in the +3 fcntl library.
Thank you very much, that makes sense to me!!!