lseek.c

来自「vc library 韩国语版 希望对大家又帮助」· C语言 代码 · 共 22 行

C
22
字号
#include <sys\stat.h>
#include <string.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
void main()
{
  int handle;
  char msg[] = "test string";
  char ch;
  handle = open("lseek.dat",
     O_CREAT | O_RDWR, S_IREAD | S_IWRITE);
  write(handle, msg, strlen(msg));
  lseek(handle, 0L, SEEK_SET);
  do
  {
     read(handle, &ch, 1);
     printf("%c", ch);
  }  while (!eof(handle));
  close(handle);
}

⌨️ 快捷键说明

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