⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 open.c

📁 德州仪器(TI) 的超低功耗16 位RISC 混合信号处理器的MSP430 平台为电池供电的测量应用提供了最终解决方案。应用包括便携式医疗设备、低功耗工业操作、无线、实用计量等
💻 C
字号:
/*******************
 *
 * Copyright 1998-2003 IAR Systems.  All rights reserved.
 *
 * $Revision: 1.8 $
 *
 * This is a template implementation of the "__open" function used by
 * the standard library.  Replace it with a system-specific
 * implementation.
 *
 * The "__open" function opens the file named "filename" as specified
 * by "mode".  "mode" & _LLIO_RDWRMASK specifies the basic file type:
 * _LLIO_RDONLY, _LLIO_WRONLY, and _LLIO_RDWR for read only, write only, and
 * read write, respectively.  Handle the rest of the _LLIO_xxx flags as
 * described in the code below.
 *
 ********************/

#include <yfuns.h>

_STD_BEGIN

#pragma module_name = "?__open"

#pragma diag_suppress = Pe826

static int handle = 3;

int __open(const char * filename, int mode)
{
  if (mode & _LLIO_CREAT)
  {
    /* Create a file if it doesn't exists. */

    /* Check what we should do with it if it exists. */
    if (mode & _LLIO_APPEND)
    {
      /* Append to the existing file. */
    }

    if (mode & _LLIO_TRUNC)
    {
      /* Truncate the existsing file. */
    }
  }

  if (mode & _LLIO_TEXT)
  {
    /* The file should be opened in text form. */
  }
  else
  {
    /* The file should be opened in binary form. */
  }

  switch (mode & _LLIO_RDWRMASK)
  {
  case _LLIO_RDONLY:
    /* The file should be opened for read only. */
    break;

  case _LLIO_WRONLY:
    /* The file should be opened for write only. */
    break;

  case _LLIO_RDWR:
    /* The file should be opened for both reads and writes. */
    break;

  default:
    return -1;
  }

  /*
   * Add the code for opening the file here.
   */

  return handle++;
}

_STD_END

⌨️ 快捷键说明

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