SlideShare ist ein Scribd-Unternehmen logo
1 von 14
FILE MANAGEMENT
PROGRAMMING IN C
SUBMITTED BY,
MS. K. BANUPRIYA
ASSISTANT PROFESSOR OF INFORMATION TECHNOLOGY
BON SECOURS COLLEGE FOR WOMEN, THANJAVUR.
WHAT IS FILE?
A collection of data (or) Information stores in a system memory is
called file.
Eg: system memory (hard disk)
TYPES OF FILE
TEXT FILE
• .txt file
• Contents will be like
alphabets,digits & special
character
• Easily understand by human
being
• It provides less security
BINARY FILE
• .bin file
• Contents will be like(0’s&1’s)
• Easily understandable by
computer
• Its provide better security with
compared to text file
o When a program is terminated ; entrie data will be
lost; so, storing in a file will perserve your data even if
the program terminates
o You can easily move your data from one computer to
another computer without make.
Why file is required?
 Creating a new file
 Opening an existing file
 Reading from the file
 Writing to the file
 Deleting to the file
 Closing the file
File Operation in C
fopen() Open a newfile (or) existing file
fclose() Close the file
fprintf() Write the data into the file
fscanf() Read data from the file
fgetc() Reads a character from the file
fputs() Write a character into the file
Declaring & opening file
FILE * fptr; declaration of file
fptr= fopen (“Filename”,”Mode”);
r - open the file reading only
w - open the file for writing only
Type of mode of file in c:
Declaring of file
FILE * P1,*P2;
P1=fopen(“data”,”r”);
P2=fopen(“result”,”w”);
Fprintf() & fscanf() function
#include <stdio.h>
Void main()
{
FILE*f;
f= fopen(“f1.txt”,”w”);
Fprintf(f,”Welcome”);
Fclose(f);
}
Reading file fscanf() function
#include <stdio.h>
Void main()
{
FILE*f;
Char buff [255];
f=fopen(“f1.txt”,”r”);
While (fscanf (f,”%s”,buff)1=EOF)
{
Printf(“%s”,buff);
}
fclose(f);
}
Output:
Welcome
Program:
#include<stdio.h>
#include<conio.h>
Void main()
int age;
char name[20];
clrscr();
printf(“enter the name & age:”);
Scanf(“%sn”,&name);
Scanf(“%dn”,&age);
fp = fopen(“Demo.txt”,”w”);
fprintf(fp,”name:%sn age:%d”,name ,age);
fclose(fp);
getch();
}
Output:
Enter the name & age : Abi
23
TYPE OF FILE PROCESSING:
Data can be accessed in file there are 2 ways to access the
data in file.
Sequential Access file
Random Access file
SEQUENTIAL ACCESS FILE RANDOM ACCESS FILE
Data stored and retrieved in a
sequential manner
Data stored and retrieved in a random
manner
eg:
sample.txt
Apple
eg:
sample.bin
101101DAF11C
1111110000B
The functions are used for random access file processing:
fseek() – file seeking
ftell() – file position
rewind() – go to f
fseek() It is used for seeking the pointer
position the file at the sequential type
ftell()
 This function return the value of
the current pointer position
 The value is count from the
beginning of the file.
rewind()
This function is used to move the
file pointer to the beginning of the
given file
Thank You

Weitere ähnliche Inhalte

Ähnlich wie C-FILE MANAGEMENT.pptx

VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5YOGESH SINGH
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-duttAnil Dutt
 
File management and handling by prabhakar
File management and handling by prabhakarFile management and handling by prabhakar
File management and handling by prabhakarPrabhakarPremUpreti
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.pptyuvrajkeshri
 
Concept of file handling in c
Concept of file handling in cConcept of file handling in c
Concept of file handling in cMugdhaSharma11
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptxLECO9
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptxSKUP1
 
File Handling in C Programming for Beginners
File Handling in C Programming for BeginnersFile Handling in C Programming for Beginners
File Handling in C Programming for BeginnersVSKAMCSPSGCT
 
Engineering Computers L34-L35-File Handling.pptx
Engineering Computers L34-L35-File Handling.pptxEngineering Computers L34-L35-File Handling.pptx
Engineering Computers L34-L35-File Handling.pptxhappycocoman
 
File Management in C
File Management in CFile Management in C
File Management in CPaurav Shah
 
File handling in 'C'
File handling in 'C'File handling in 'C'
File handling in 'C'Gaurav Garg
 

Ähnlich wie C-FILE MANAGEMENT.pptx (20)

VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5VIT351 Software Development VI Unit5
VIT351 Software Development VI Unit5
 
File Management
File ManagementFile Management
File Management
 
File handling-c
File handling-cFile handling-c
File handling-c
 
1file handling
1file handling1file handling
1file handling
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
 
Unit5
Unit5Unit5
Unit5
 
Files_in_C.ppt
Files_in_C.pptFiles_in_C.ppt
Files_in_C.ppt
 
File management and handling by prabhakar
File management and handling by prabhakarFile management and handling by prabhakar
File management and handling by prabhakar
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.ppt
 
Concept of file handling in c
Concept of file handling in cConcept of file handling in c
Concept of file handling in c
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptx
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptx
 
File Handling in C Programming for Beginners
File Handling in C Programming for BeginnersFile Handling in C Programming for Beginners
File Handling in C Programming for Beginners
 
File in C Programming
File in C ProgrammingFile in C Programming
File in C Programming
 
Engineering Computers L34-L35-File Handling.pptx
Engineering Computers L34-L35-File Handling.pptxEngineering Computers L34-L35-File Handling.pptx
Engineering Computers L34-L35-File Handling.pptx
 
File Management in C
File Management in CFile Management in C
File Management in C
 
file_c.pdf
file_c.pdffile_c.pdf
file_c.pdf
 
file_handling_in_c.ppt
file_handling_in_c.pptfile_handling_in_c.ppt
file_handling_in_c.ppt
 
File handling in 'C'
File handling in 'C'File handling in 'C'
File handling in 'C'
 
File Handling
File HandlingFile Handling
File Handling
 

Mehr von banu236831

Web Design-III IT.ppt
Web Design-III IT.pptWeb Design-III IT.ppt
Web Design-III IT.pptbanu236831
 
pointer in c++ -banu.pptx
pointer in c++ -banu.pptxpointer in c++ -banu.pptx
pointer in c++ -banu.pptxbanu236831
 
understanding-operating-systems-Banu.ppt
understanding-operating-systems-Banu.pptunderstanding-operating-systems-Banu.ppt
understanding-operating-systems-Banu.pptbanu236831
 
distributed os.ppt
distributed os.pptdistributed os.ppt
distributed os.pptbanu236831
 
Human Resource BPO.ppt
Human Resource BPO.pptHuman Resource BPO.ppt
Human Resource BPO.pptbanu236831
 
c programming language.pptx
c programming language.pptxc programming language.pptx
c programming language.pptxbanu236831
 
NT-Soft-skills-PPT new.pptx
NT-Soft-skills-PPT new.pptxNT-Soft-skills-PPT new.pptx
NT-Soft-skills-PPT new.pptxbanu236831
 

Mehr von banu236831 (8)

Web Design-III IT.ppt
Web Design-III IT.pptWeb Design-III IT.ppt
Web Design-III IT.ppt
 
os.ppt
os.pptos.ppt
os.ppt
 
pointer in c++ -banu.pptx
pointer in c++ -banu.pptxpointer in c++ -banu.pptx
pointer in c++ -banu.pptx
 
understanding-operating-systems-Banu.ppt
understanding-operating-systems-Banu.pptunderstanding-operating-systems-Banu.ppt
understanding-operating-systems-Banu.ppt
 
distributed os.ppt
distributed os.pptdistributed os.ppt
distributed os.ppt
 
Human Resource BPO.ppt
Human Resource BPO.pptHuman Resource BPO.ppt
Human Resource BPO.ppt
 
c programming language.pptx
c programming language.pptxc programming language.pptx
c programming language.pptx
 
NT-Soft-skills-PPT new.pptx
NT-Soft-skills-PPT new.pptxNT-Soft-skills-PPT new.pptx
NT-Soft-skills-PPT new.pptx
 

Kürzlich hochgeladen

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

C-FILE MANAGEMENT.pptx

  • 1. FILE MANAGEMENT PROGRAMMING IN C SUBMITTED BY, MS. K. BANUPRIYA ASSISTANT PROFESSOR OF INFORMATION TECHNOLOGY BON SECOURS COLLEGE FOR WOMEN, THANJAVUR.
  • 2. WHAT IS FILE? A collection of data (or) Information stores in a system memory is called file. Eg: system memory (hard disk)
  • 3. TYPES OF FILE TEXT FILE • .txt file • Contents will be like alphabets,digits & special character • Easily understand by human being • It provides less security BINARY FILE • .bin file • Contents will be like(0’s&1’s) • Easily understandable by computer • Its provide better security with compared to text file
  • 4. o When a program is terminated ; entrie data will be lost; so, storing in a file will perserve your data even if the program terminates o You can easily move your data from one computer to another computer without make. Why file is required?
  • 5.  Creating a new file  Opening an existing file  Reading from the file  Writing to the file  Deleting to the file  Closing the file File Operation in C
  • 6. fopen() Open a newfile (or) existing file fclose() Close the file fprintf() Write the data into the file fscanf() Read data from the file fgetc() Reads a character from the file fputs() Write a character into the file
  • 7. Declaring & opening file FILE * fptr; declaration of file fptr= fopen (“Filename”,”Mode”); r - open the file reading only w - open the file for writing only Type of mode of file in c:
  • 8. Declaring of file FILE * P1,*P2; P1=fopen(“data”,”r”); P2=fopen(“result”,”w”);
  • 9. Fprintf() & fscanf() function #include <stdio.h> Void main() { FILE*f; f= fopen(“f1.txt”,”w”); Fprintf(f,”Welcome”); Fclose(f); }
  • 10. Reading file fscanf() function #include <stdio.h> Void main() { FILE*f; Char buff [255]; f=fopen(“f1.txt”,”r”); While (fscanf (f,”%s”,buff)1=EOF) { Printf(“%s”,buff); } fclose(f); } Output: Welcome
  • 11. Program: #include<stdio.h> #include<conio.h> Void main() int age; char name[20]; clrscr(); printf(“enter the name & age:”); Scanf(“%sn”,&name); Scanf(“%dn”,&age); fp = fopen(“Demo.txt”,”w”); fprintf(fp,”name:%sn age:%d”,name ,age); fclose(fp); getch(); } Output: Enter the name & age : Abi 23
  • 12. TYPE OF FILE PROCESSING: Data can be accessed in file there are 2 ways to access the data in file. Sequential Access file Random Access file SEQUENTIAL ACCESS FILE RANDOM ACCESS FILE Data stored and retrieved in a sequential manner Data stored and retrieved in a random manner eg: sample.txt Apple eg: sample.bin 101101DAF11C 1111110000B
  • 13. The functions are used for random access file processing: fseek() – file seeking ftell() – file position rewind() – go to f fseek() It is used for seeking the pointer position the file at the sequential type ftell()  This function return the value of the current pointer position  The value is count from the beginning of the file. rewind() This function is used to move the file pointer to the beginning of the given file