file.c

来自「SimpleGraphicOperatingSystem 32位图形化操作系统 」· C语言 代码 · 共 54 行

C
54
字号


#include <osdef.h>
#include <stdio.h>

EXPORT FILE _iob[4];

EXPORT int fflush( 
   FILE *stream 
){
    dprintf("fflush 0x%X\n", stream );
}

EXPORT int _setmode (
   int fd,
      int mode 
){
    dprintf("set file %d mode to %d failed\n", fd, mode );
    return 0;
}

//写文件
EXPORT int fwrite( const char* buf, int len, int count, FILE *fp )
{
    dprintf("fwrite not implemented\n");
}

EXPORT int open( const char* fname, int mode, int flag )
{
    return KOpenFile( (char*)fname, mode, flag );
}

EXPORT int close( int i )
{
    KCloseFile( i);
}

EXPORT int read( int i, char* buf, int count )
{
    return KReadFile( i, buf, count );
}

EXPORT int write( int i, const char* buf, int count )
{
    return KWriteFile( i, buf, count );
}


EXPORT int lseek( int i, int step, int pos )
{
    return KSeekFile( i, step, pos );
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?