fseek.c

来自「mips架构的bootloader,99左右的版本 但源代码现在没人更新了」· C语言 代码 · 共 38 行

C
38
字号
/************************************************************* * File: lib/fseek.c * Purpose: Part of C runtime library * Author: Phil Bunce (pjb@carmel.com) * Revision History: *	970304	Start of revision history */#include <stdio.h>/**************************************************************  fseek(fp,offset,whence)*/fseek(fp,offset,whence)FILE *fp;long offset;int whence;{int n;if (whence == 1) { /* relative seek */	if (offset > 0 && offset <= fp->cnt) {		fp->cnt -= offset;		fp->ptr += offset;		return(0);		}	if (offset < 0 && offset < (fp->ptr-fp->buf)) {		fp->cnt += offset;		fp->ptr -= offset;		return(0);		}	}fp->cnt = 0;n = lseek(fp->fd,offset,whence);return(n);}

⌨️ 快捷键说明

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