freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

第10章文件-文庫(kù)吧資料

2025-08-07 15:27本頁(yè)面
  

【正文】 Chapter 10 Files feof()函數(shù) ——文件結(jié)束測(cè)試函數(shù) 常用的調(diào)用形式: FILE *fp; feof(fp); fp:文件指針變量。 ? puts(str)。 ? fgets(str,81,fp)。 ? fclose(fp)。 ? gets(str)。 ? char str[81]。 /*關(guān)閉文件 */ ?} The C Programming Language Chapter 10 Files 【 例 】 從鍵盤輸入一個(gè)字符串,保存到文本文件“ ”中,再將此文件內(nèi)容顯示出來。) /*輸入字符,并存儲(chǔ)到指定文件中 */ ? fputc(ch,fp)。 ?} ?for(。 ?if ( ( fp=fopen ( argv[1] , w ) )= =NULL) /*打開文件失敗 */ ?{ ? printf( \nCan not open thei file. )。 ? include”” ?void main(int arge,char*argv[]) ?{ ?FILE *P。 字符數(shù)據(jù)文件操作 The C Programming Language Chapter 10 Files 【 例 10. 6】 將鍵盤上輸入一個(gè)字符串( 以“ ”作為結(jié)束字符),以 ASCII碼形式存儲(chǔ)到一個(gè)磁盤文件中。) 寫到文件指針 fp所指向的文件中 。 函數(shù)功能: 將字符串 ( 不包括字符串結(jié)束標(biāo)志 39。 /*順序讀入并顯示 */ fclose(fp)。 exit(1)。 exit (0)。 if(argc!==2) { printf( \n the number of arguments not correct. )。 include void main(int argc,char *argv[ ]) { FILE *fp。 若輸入操作成功,返回字符數(shù)組的首地址; 若文件結(jié)束或輸入操作失敗,則返回 NULL。\039。 fp:文件指針變量 。 ? fclose(wfp)。 ? fopen(wfp, %d,%d,%d\n , ? sc1,sc2,sc3)。sc2,amp。i++) ?{ ? fscanf(rfp, %d,%d,%d , ? amp。 ?for(i=0。 fprintf(wfp, %d,%d,%d\n ,sc1,sc2,sc3)。sc2,amp。 scanf( %d,%d,%d ,amp。 fprintf(wfp, %d,%d,%d\n ,sc1,sc2,scc3)。sc2,amp。i++) { fscanf(wfp, %d,%d,%d ,amp。 for(i=0。 rfp=fopen( , r)。 /*定義文件指針 */ float sc1,sc2,sc3。 fclose(fp)。sc3)。sc1,amp。 } printf( Please input third student’s three scores: )。 if((fp=fopen( , a ))== NULL) { printf( \nCan not open file .\n )。 # include main() { FILE *fp。 printf( The scores average are:%d,%d,%d\n ,sum/51,sum2/5,sum3/5)。 printf( The scores are:%d,%d,%d ,sc1,sc2,sc3)。 sum2=sum2+sc2。sc3)。sc1,amp。i5。 exit(1)。 int i。 1】 所產(chǎn)生的數(shù)據(jù)文件 ,并計(jì)算各門課程的平均分。 } fclose(fp)。sc3)。sc1,amp。i++) { printf( please input No.%d there scores: ,i+1)。 } for(i=0。 if((fp=fopen( , w ))== NULL) { printf( \nCan not open file .\n )。 /*定義文件指針 */ float sc1,sc2,sc3。 //若文件中有 3, ,則將 3送入 i, t The C Programming Language Chapter 10 Files 文件建立 【 例 】 鍵盤輸入 5位同學(xué)的 3門課成績(jī),保存數(shù)據(jù)文件 。i,amp。出錯(cuò)或文件尾 ,返回 EOF 例 fprintf(fp,“%d,%”,i,t)。 “r+/rb+” (讀寫 ) “a/ab” (追加 ) “w/wb” (只寫 ) “r/rb” (只讀 ) “w+
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1