fopen, fseek,ftell, rewind, fclose
等的用法
herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
計算你上學期加權平均
-
產生50個元素的陣列並排序
-
請用 C/C++/java寫一簡易程式
-
Caesar挪移碼密文: MCLGZ 請破譯!
-
計算你的BMI
-
借錢500萬,年利18%,每月複利計算,請問連本帶利的金額 5, 10, 15, 20, 25, 30, 35, 40, 45, 50年的金額。並比較公式: A*exp(0.18n) A*(1+0.18/12)^(12*n), n=年數, A=本金 hint: math.h, p...
-
array ex 1, 2,3,7,8
-
利用static方法輸出BMI
-
Fibonacci sequence: a[0]=1, a[1]=1, a[2]=2, a[3]=3, a[4]=5,...... In general, a[n]=1 as n=0,1, a[n]=a[n-1]+a[n-2] as n>=2. Use this...
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開啟的檔案資料。
張貼留言