Page 1 of 1

Convert F_FILE * to FILE * or file descriptor?

Posted: Tue Mar 20, 2018 7:36 am
by Heliotopos
Is it possible to convert the F_FILE * returned by the EFFS f_open() function to a FILE * or file descriptor? I'd like to use either vfprintf() with the former or ReplaceStdio() with the latter to print to my files.

Re: Convert F_FILE * to FILE * or file descriptor?

Posted: Wed Mar 21, 2018 1:05 pm
by Jon
Hi Heliotopos,

Unfortunately, a conversion like that isn't really an option. If you're looking to use the vfprintf() functionality with regard to format specifiers, there is an equivalent function available that's provided with our EFFS libraries, f_fprintf().

The signature is:

f_fprintf(F_FILE* fp, const char *format, ... );

Its usage can be found throughout our EFFS examples.

Kind Regards,
Jon

Re: Convert F_FILE * to FILE * or file descriptor?

Posted: Wed Mar 21, 2018 1:46 pm
by Heliotopos
Exactly what I was looking for, thanks!

Re: Convert F_FILE * to FILE * or file descriptor?

Posted: Wed Mar 21, 2018 2:34 pm
by Jon
Anytime! =)