Is fopen available when using the C API?

,

I'm confused as to what C standard functions are available with the Playdate. Just recently I tried to use fopen and found that while it compiles for the Playdate Simulator, it either fails to link when compiled for arm / the physical Playdate without --specs=nosys.specs, or it links but then fails and returns NULL for a valid file when using it with --specs=nosys.specs.

I read through this thread hoping to get some more info: Is there a list of C standard library function available on Playdate?
...but it doesn't say much, other than to use --specs=nosys.specs. But reading up on that, I believe it just implements certain stdlib functions with stubs, which might explain why fopen isn't working.

Am I correct then that this standard function is not available on the Playdate? If so, what standard functions are actually safe to use?

Would it be better to compile without --specs=nosys.specs and consider any standard function that triggers a link error to be unavailable?

You can’t use fopen directly, you have to use the one provider by the Playdate API:

If you are using external code that depends on fopen, you can roll your own implementation and pass the arguments to the Playdate open function.

That's essentially what I did.

Is there a list anywhere of which standard C functions are (or are not) available on the Playdate?

I don't think there is an official list, but I know that people have had problems with printf/sprintf, fopen/fread/fwrite, and assert.

On the other hand, functions from math.h and string.h are available.

EDIT: free and malloc are redirected (since may 2022), so they are available as well.