fopen?

elevenj 2002-06-26 05:29:30
FILE *fpInput=NULL;
FILE *fpOutput=NULL;
fpInput=fopen("rng_in.txt","r");
fpOutput=fopen("rng_out.txt","w");
谁能帮忙解释一下fopen的操作,及结果。
...全文
608 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
elevenj 2002-06-28
  • 打赏
  • 举报
回复
up ,再次up
elevenj 2002-06-28
  • 打赏
  • 举报
回复
你这不是起哄吗?
fangrk 2002-06-28
  • 打赏
  • 举报
回复
多看帮助啊!要学会自学
hurrah_yule 2002-06-27
  • 打赏
  • 举报
回复
up
elevenj 2002-06-27
  • 打赏
  • 举报
回复
up,没办法,只好自己up了
elevenj 2002-06-27
  • 打赏
  • 举报
回复
那些相关方法操作这类指针,处理文件
richard_hu 2002-06-26
  • 打赏
  • 举报
回复
fopen就是根据第二个参数来决定对第一个参数所指定的文件作什么操作,是读,还是写,还是创建,等等。返回值为一个指向FILE结构的指针。我们接下来所有的操作都是对这个指针进行的。
fangrk 2002-06-26
  • 打赏
  • 举报
回复
Syntax

#include <stdio.h>
FILE *fopen(const char *filename, const char *mode);
FILE *_wfopen(const wchar_t *filename, const wchar_t *mode);

Description

Opens a stream.

fopen opens the file named by filename and associates a stream with it. fopen returns a pointer to be used to identify the stream in subsequent operations.

The mode string used in calls to fopen is one of the following values:

Value Description

r Open for reading only.

w Create for writing. If a file by that name already exists, it will be overwritten.

a Append; open for writing at end-of-file or create for writing if the file does not exist.

r+ Open an existing file for update (reading and writing).

w+ Create a new file for update (reading and writing). If a file by that name already exists, it will be overwritten.

a+ Open for append; open (or create if the file does not exist) for update at the end of the file.


To specify that a given file is being opened or created in text mode append a t to the mode string (rt w+t and so on). Similarly to specify binary mode append a b to the mode string (wb a+b and so on). fopen also allows the t or b to be inserted between the letter and the + character in the mode string; for example rt+ is equivalent to r+t.

If a t or b is not given in the mode string the mode is governed by the global variable _fmode. If _fmode is set to O_BINARY files are opened in binary mode. If _fmode is set to O_TEXT they are opened in text mode. These O_... constants are defined in fcntl.h.

When a file is opened for update, both input and output can be done on the resulting stream; however,

output cannot be directly followed by input without an intervening fseek or rewind
input cannot be directly followed by output without an intervening fseek, rewind, or an input that encounters end-offile

Return Value

On successful completion fopen returns a pointer to the newly opened stream. In the event of error it returns NULL.
于2024年4月-2025年9月期间,研究团队在贵州习水国家级自然保护区制定39条样线,涵盖灌木林、常绿阔叶林、针叶林、常绿落叶阔叶混交林、针阔混交林等不同植被类型,每条样线分春夏秋冬4个季节采集样品,用真菌采集软件记录经纬度、海拔、采集地点、时间、生境等信息,使用佳能相机(R6 mark Ⅱ)对大型真菌进行拍照,并采集标本,标本存放于贵州省生物研究所大型真菌标本馆(HGAMF)。 通过形态学初步鉴定,结合分子生物学最终鉴定,参考已]报道的中国毒蘑菇名录开展毒蘑菇的认定。 调查到保护区内有毒真菌7目25科64种,导致中毒的主要类型有急性肾衰竭型、神经精神型和胃肠炎型。最终形成贵州习水国家级自然保护区大型有毒真菌图片数据集,它由以下2个部分组成。 (1)附件1包含78张原始照片(.JPG),照片名字包括了大型有毒真菌的拉丁名和中文名,若无中文名的直接用拉丁名。 (2)附件2是一个压缩文件,包含了2张工作表,其中一张表是大型有毒真菌39条样线的信息,另一张表是大型有毒真菌的中毒类型。 照片采用佳能相机R6 mark Ⅱ拍摄,物种鉴定通过多种文献核实,并经两位以上专家鉴定确认。该数据集可为研究地及周边的普通人识别有毒大型真菌提供参考,通过及时的图片对比,能有效避免误采误食大型有毒真菌,同时为因误食大型真菌可能引发的身体损伤进行了总结,能为患者及时治疗提供参考。

70,038

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧