1.File and Stream
Definition Stream:
-To keep key in data from keyboard need to be saved at secondary storage device as a data file
-Stream is a sequence of character
There are 3 standard streams activated in C
-Standard Input Stream
-Standard Output Stream
-Standard Error Stream
File Definition:
-File is a collection of record
-Record is a collection of field
-Field is a block of byte
2.Buffer Area
Buffer Area Definiton:
-Buffer area is part of the memory used as a temporary space before data moved to a file
-Also known as stream pointer
3.Open File
Opening a File Using fopen() :
-FILE*fopen(const char*filename, const char*mode);
-fopen() return a pointer to the start of a buffer area
-NULL will be returned if file unable to open.
3.5.Open File (Mode)
1.r=open file+read
2.w=create file+write
3.a=open file+append
4.r+=open file+read/write
5.w+=create file+read/write
6.a+=open file+read/append
7.rb=open file+read(binary File)
8.wb=create file+write(binary File)
4.Close File
-Int fclose(FILE*stream);
-fclose() definied at <stdio.h>
5.Input/Output File
1.fgetc(input)
2.fputc(output)
3.fgets(input)
4.fputs(output)
5.fscanf(input)
6.fprintf(output)
7.fwrite
8.fread
9.feof
Tidak ada komentar:
Posting Komentar