mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2025-04-19 17:37:09 +02:00
23 lines
388 B
C
23 lines
388 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include "fileutil.h"
|
|
|
|
FILE *fdopen(int fd, char const *mode)
|
|
{
|
|
FILE *fp = calloc(1, sizeof *fp);
|
|
if(!fp) goto err;
|
|
fp->fd = -1;
|
|
|
|
int flags = __fp_parse_mode(mode, fp);
|
|
if(flags < 0) goto err;
|
|
|
|
__fp_open(fp, fd, true);
|
|
|
|
/* TODO: fdopen(): Seek to the current file offset of the fd */
|
|
|
|
return fp;
|
|
|
|
err:
|
|
__fp_close(fp, true);
|
|
return NULL;
|
|
}
|