首页 > 编程知识 正文

c语言程序设计基础实验报告总结,c语言程序设计实验报告心得体会

时间:2023-05-05 06:13:12 阅读:50470 作者:1418

c语言文件操作sfdjr

文件管理功能

文件打开/关闭

FILE,*infile,=fopen(ride? ) )、腼腆的项链);

flose(INF自定义e );

文件读取:

Fgetc:

格式: int fgetc (文件^流);

readsacharacterfromthefilepointingtothefilepointerstream?

thereturnvalueofthisfunctionisabytethatreturnstheread.returns eof (-1 ) ifitreadattheendofthefileorwhentheeerrrorisread。

Fgets:

theprototypeischar*fgets(char、*s、int、n、FILE、* stream );

Parameter:

* s : characterpointertothedataaddressthatwillbestored。

n :集成数据,whichreadsn-1 charactersfromthestream。

^stream: pointer data,the stream to read。

功能:

readntcharactersfromthefilepointerstream,saveinthespacewheresisthestartingaddress,until you have completed a row,andifsucccescestestred

Fscanf:

Function name: fscanf

function : performsformattedinputfromastream,fscanfendswithspacesandlinebreaks,and ends with spaces? This is different from fgets,wherefgetsencountersspacesthatdonotend。

Usage: int,fscanf (文件、^stream、char、^format、

int fscanf (文件指针,格式字符串,输入列表);

Example:wldny,%s%d%lf,a,b,c )

Return value: integer,valueequaltothenumberof [ argument? _

Fread:

Function prototypes: size_t,fread(void、^buffer、size_t、size、size_t、count、FILE、^stream );

function : readdatafromafilestream,read count elements,each element size bytes? If the call succeeds,返回计数? If the call is successful,theactualreadsize * countbytesareread

Parameter:

buffer : isusedtoreceivedatamemoryaddresses,at least size*count bytes in size

size : thesizeofasingleelement,in bytes

The number of count: elements,each of which is size bytes? stream :输入流

return value 3360 thenumberofelementsactuallyread.ifthereturnvalueisnotthesameascount,theendorerrorofthe

getstheerrorinformationfromferrorandf

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。