fopen, fseek,ftell, rewind, fclose
等的用法
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你上學期加權平均
-
請用C/C++ 程式計算 S=1*1+2*2+3*3+4*4+.....+20*20=?
-
輸出課表代碼矩陣 Hint: 2-D array, double-for loop
-
輸出字串20次
-
用 while loop 算 s=3*3+4*4+....88*88
-
請簡易說明Bitmap, Sleep的使用方式 請參考 https://anwendeng.blogspot.com/2020/03/visual-studio-2019-cwindows-formbitmap.html https://anwendeng.blogsp...
-
產生10個0~99的亂數存在a[10] 中
-
data structure 期中考乙
-
連續複利
7 則留言:
fopen:開啟檔案或URL
int fopen (string filename, string mode [, int use_include_path])
fseek:移動檔案指標
int fseek (int fp, int offset [, int whence])
ftell:取得檔案指標讀/寫的位置
int ftell (int fp)
rewind:重置檔案指標
int rewind (int fp)
fclose:關閉已開啟的檔案指標
int fclose (int fp)
#include
int main(void)
{
FILE *fp; char N[5];
printf("請輸入檔名:");
gets(N);
if(fp = fopen(N , "w")) == NULL){
printf("\a無法開啟檔案。 \n");
}else {
/* 從檔案寫入資料 */
fclose(fp) ; /* 關閉檔案 */
}
return (0) ;
}
fopen 語法 : fopen ( const char * filename, const char * mode ); 開啟檔案
fclose 語法: int fclose(int fp); 關閉已打開的文件。
ftell 語法:long int ftell ( FILE * stream ); 取得檔案指標讀/寫的位置
fseek 語法:int fseek ( FILE * stream, long int offset, int origin ); 移動檔案指標
rewind 語法:void rewind ( FILE * stream ); 重置檔案指標
fopen 開啟檔案或URL
FILE * fopen ( const char * filename, const char * mode );
fseek 移動檔案指標
int fseek ( FILE * stream, long int offset, int origin );
ftell 取得檔案指標讀/寫的位置
long int ftell ( FILE * stream );
rewind 重置檔案指標
void rewind ( FILE * stream );
ftell :
long int ftell
( FILE * stream );
取得檔案指標讀/寫的位置
fseek :
int fseek
( FILE * stream, long int offset, int origin );
移動檔案指標
rewind :
void rewind
( FILE * stream );
重置檔案指標
fopen:
fopen
( const char * filename, const char * mode );
開啟檔案
fclose: int fclose(int fp);
關閉已打開的文件
fopen:開啟檔案或URL
FILE * fopen ( const char * filename, const char * mode );
fseek:移動檔案指標
int fseek ( FILE * stream, long int offset, int origin );
ftell:取得檔案指標讀/寫的位置
long int ftell ( FILE * stream );
rewind:重置檔案指標
void rewind ( FILE * stream );
fclose:關閉已開啟的檔案指標
int fclose ( FILE * stream );
fopen : 以唯讀或唯寫的方式開起檔案資料。
fseek : 將檔案資料的指標移到指定偏移位元上。
ftell : 傳回檔案的指標偏移位元值,當發生錯誤時,傳回false值。檔案指標必須是有效的,且使用fopen函式開啟才能作用。
rewind : 重置檔案的讀寫位置指標到檔案的開頭出,發生錯誤則傳回0。檔案指標必須是有效的,且使用fopen函式開啟的檔案。
fclose : 關閉以fopen開啟的檔案資料。
張貼留言