c - Is it possible to write fopen(), fscanf() or fprintf() functions using only C?
问题描述
I have no issues with the library functions. I know that they work well. I am interested in their implementation. My question is: Can I write working versions of these functions for Windows x64 using only C?
解决方案
Many of the stnadard library functions are written in C, and fopen
, fread
etc. are no exception. You can write a wrapper around open
, read
, write
etc. which are usually lower level functions.
If those are not available, you can also do the same, calling the respective OS functions and wrapping them with your own implementation, you just have to make sure that they are complying to the standard.
Just as an example you can find a source for fopen
here.
推荐阅读
- ruby-on-rails - 即使新记录无效,Rails has_one 构建关联也会删除现有记录
- c# - NUnit 测试项目的 .NET Core 容器定义
- rust - 临时值在自定义结构中的寿命不够长
- delphi - 使用 TFDTable 对网格中的数据进行排序
- asp.net - Azure WebApp 的起点
- dart - 如何修复 Flutter 下拉按钮溢出问题?
- php - 当我检查输入时,它总是给出否定的响应,这是为什么呢?
- node.js - 查询范围内 npm 包的特定版本信息
- python - 将文件保存在名称为用户名的文件夹中
- graphql - GitHub API 是否为架构查询返回无效结果?