SlideShare a Scribd company logo
From ArguSacademy
EXTRA
EXTRA
EXTRA
#include<stdio.h> 
void main() 
{ 
char ch; 
FILE *fptr; 
fptr =fopen("c:myfile.txt","a"); 
printf("Enter the data to be stored in a filen"); 
while((ch=getchar())!=EOF) 
{ 
fputc(ch,fptr); 
} 
fclose(fptr); 
fptr=fopen("c:myfile.text","r"); 
while((ch=fgetc(fptr))!=EOF) 
{ 
printf("%c",ch); 
} 
fclose(fptr); 
} 
EXTRA
EXTRA
#include<stdio.h> 
void main() 
{ 
char ch; 
FILE *fp; 
fp=fopen("sample.txt","w"); 
printf("Input a character::n"); 
while((ch=fgetc(stdin))!=EOF) 
{ 
fputc(ch,fp); 
} 
fclose(fp); 
fp=fopen("sample.txt","r"); 
while((ch=fgetc(fp))!=EOF) 
printf("%c",ch); 
} 
EXTRA
EXTRA
EXTRA
#include<conio.h> 
void main() 
{ 
FILE *fp; 
char s[100]; 
fp=fopen("text.txt","w"); 
if(fp==NULL) 
{ 
puts("cannot open a file"); 
exit(1); 
} 
printf("Enter a text (type end to stop):n"); 
while(strcmp(gets(s),"end")!=0) 
{ 
fputs(s,fp); 
} 
fclose(fp); 
fp=fopen("text.txt","r"); 
if(fgets(s,10,fp)!=NULL) 
{ 
printf("%s",s); 
} 
} 
EXTRA

More Related Content

What's hot

File in C Programming
File in C ProgrammingFile in C Programming
File in C Programming
Sonya Akter Rupa
 
File handling in c
File  handling in cFile  handling in c
File handling in c
thirumalaikumar3
 
File Management
File ManagementFile Management
File Management
Ravinder Kamboj
 
File handling in C
File handling in CFile handling in C
File handling in C
Rabin BK
 
File in C language
File in C languageFile in C language
File in C language
Manash Kumar Mondal
 
File handling-c
File handling-cFile handling-c
C Programming Unit-5
C Programming Unit-5C Programming Unit-5
C Programming Unit-5
Vikram Nandini
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
Anil Dutt
 
Understanding c file handling functions with examples
Understanding c file handling functions with examplesUnderstanding c file handling functions with examples
Understanding c file handling functions with examplesMuhammed Thanveer M
 
File handling-c programming language
File handling-c programming languageFile handling-c programming language
File handling-c programming language
thirumalaikumar3
 
file
filefile
file
teach4uin
 
File handling in C by Faixan
File handling in C by FaixanFile handling in C by Faixan
File handling in C by Faixan
ٖFaiXy :)
 
File handling in c
File handling in cFile handling in c
File handling in c
aakanksha s
 
Lecture 20 - File Handling
Lecture 20 - File HandlingLecture 20 - File Handling
Lecture 20 - File Handling
Md. Imran Hossain Showrov
 
File Management in C
File Management in CFile Management in C
File Management in C
Munazza-Mah-Jabeen
 
file management in c language
file management in c languagefile management in c language
file management in c language
chintan makwana
 
File Handling in C
File Handling in C File Handling in C
File Handling in C
Subhanshu Maurya
 

What's hot (20)

File in C Programming
File in C ProgrammingFile in C Programming
File in C Programming
 
File handling in c
File  handling in cFile  handling in c
File handling in c
 
File Management
File ManagementFile Management
File Management
 
File handling in C
File handling in CFile handling in C
File handling in C
 
File in C language
File in C languageFile in C language
File in C language
 
File handling-c
File handling-cFile handling-c
File handling-c
 
File handling in c
File handling in cFile handling in c
File handling in c
 
C Programming Unit-5
C Programming Unit-5C Programming Unit-5
C Programming Unit-5
 
File handling-dutt
File handling-duttFile handling-dutt
File handling-dutt
 
Understanding c file handling functions with examples
Understanding c file handling functions with examplesUnderstanding c file handling functions with examples
Understanding c file handling functions with examples
 
File handling-c programming language
File handling-c programming languageFile handling-c programming language
File handling-c programming language
 
file
filefile
file
 
File handling in C by Faixan
File handling in C by FaixanFile handling in C by Faixan
File handling in C by Faixan
 
File handling in c
File handling in cFile handling in c
File handling in c
 
File handling in c
File handling in cFile handling in c
File handling in c
 
Lecture 20 - File Handling
Lecture 20 - File HandlingLecture 20 - File Handling
Lecture 20 - File Handling
 
File Management in C
File Management in CFile Management in C
File Management in C
 
Unit5
Unit5Unit5
Unit5
 
file management in c language
file management in c languagefile management in c language
file management in c language
 
File Handling in C
File Handling in C File Handling in C
File Handling in C
 

Viewers also liked

VISUAL BASIC .net iv
VISUAL BASIC .net ivVISUAL BASIC .net iv
VISUAL BASIC .net iv
argusacademy
 
Computer development
Computer developmentComputer development
Computer development
argusacademy
 
Multimedia basic
Multimedia basicMultimedia basic
Multimedia basic
argusacademy
 
Php opps
Php oppsPhp opps
Php opps
argusacademy
 
TALLY 1 st level entry
TALLY 1 st level entryTALLY 1 st level entry
TALLY 1 st level entry
argusacademy
 
TALLY Pos ENTRY
TALLY Pos ENTRYTALLY Pos ENTRY
TALLY Pos ENTRY
argusacademy
 
Application software
Application softwareApplication software
Application software
argusacademy
 
VISUAL BASIC .net iii
VISUAL BASIC .net iiiVISUAL BASIC .net iii
VISUAL BASIC .net iii
argusacademy
 
Php basic
Php basicPhp basic
Php basic
argusacademy
 
Java script
Java scriptJava script
Java script
argusacademy
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRY
argusacademy
 
TALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRYTALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRY
argusacademy
 
Paint
PaintPaint
C programming flow of controls
C  programming flow of controlsC  programming flow of controls
C programming flow of controls
argusacademy
 
Php oops1
Php oops1Php oops1
Php oops1
argusacademy
 
COMPUTER Tips ‘n’ Tricks
COMPUTER Tips ‘n’   TricksCOMPUTER Tips ‘n’   Tricks
COMPUTER Tips ‘n’ Tricks
argusacademy
 
1 tally basic
1 tally basic1 tally basic
1 tally basic
argusacademy
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net ii
argusacademy
 
Virus examples
Virus examplesVirus examples
Virus examples
argusacademy
 

Viewers also liked (20)

VISUAL BASIC .net iv
VISUAL BASIC .net ivVISUAL BASIC .net iv
VISUAL BASIC .net iv
 
Computer development
Computer developmentComputer development
Computer development
 
Multimedia basic
Multimedia basicMultimedia basic
Multimedia basic
 
Php opps
Php oppsPhp opps
Php opps
 
TALLY 1 st level entry
TALLY 1 st level entryTALLY 1 st level entry
TALLY 1 st level entry
 
TALLY Pos ENTRY
TALLY Pos ENTRYTALLY Pos ENTRY
TALLY Pos ENTRY
 
Application software
Application softwareApplication software
Application software
 
VISUAL BASIC .net iii
VISUAL BASIC .net iiiVISUAL BASIC .net iii
VISUAL BASIC .net iii
 
Php basic
Php basicPhp basic
Php basic
 
Java script
Java scriptJava script
Java script
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRY
 
TALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRYTALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRY
 
Paint
PaintPaint
Paint
 
C programming flow of controls
C  programming flow of controlsC  programming flow of controls
C programming flow of controls
 
Php oops1
Php oops1Php oops1
Php oops1
 
COMPUTER Tips ‘n’ Tricks
COMPUTER Tips ‘n’   TricksCOMPUTER Tips ‘n’   Tricks
COMPUTER Tips ‘n’ Tricks
 
1 tally basic
1 tally basic1 tally basic
1 tally basic
 
Groups
GroupsGroups
Groups
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net ii
 
Virus examples
Virus examplesVirus examples
Virus examples
 

Similar to C programming file handling

Data structures
Data structuresData structures
Data structures
gayatrigayu1
 
File handling in c language
File handling in c languageFile handling in c language
File handling in c language
Harish Gyanani
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
C Language Lecture 22
C Language Lecture 22C Language Lecture 22
C Language Lecture 22
Shahzaib Ajmal
 
C programms
C programmsC programms
C programms
Mukund Gandrakota
 
C basics
C basicsC basics
C basicsMSc CST
 
Data Structure Using C - FILES
Data Structure Using C - FILESData Structure Using C - FILES
Data Structure Using C - FILES
Harish Kamat
 
10〜30分で何となく分かるGo
10〜30分で何となく分かるGo10〜30分で何となく分かるGo
10〜30分で何となく分かるGoMoriyoshi Koizumi
 
C-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdfC-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdf
herminaherman
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
Rahul Chugh
 
PPS Notes Unit 5.pdf
PPS Notes Unit 5.pdfPPS Notes Unit 5.pdf
PPS Notes Unit 5.pdf
Sreedhar Chowdam
 
File handling(some slides only)
File handling(some slides only)File handling(some slides only)
File handling(some slides only)
Kamlesh Nishad
 
Institute management
Institute managementInstitute management
Institute management
varun arora
 
Ch3(working with file)
Ch3(working with file)Ch3(working with file)
Ch3(working with file)
Chhom Karath
 

Similar to C programming file handling (20)

Data structures
Data structuresData structures
Data structures
 
Vcs26
Vcs26Vcs26
Vcs26
 
File handling in c language
File handling in c languageFile handling in c language
File handling in c language
 
String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
 
14. fiile io
14. fiile io14. fiile io
14. fiile io
 
C Language Lecture 22
C Language Lecture 22C Language Lecture 22
C Language Lecture 22
 
L8 file
L8 fileL8 file
L8 file
 
Files
FilesFiles
Files
 
C programms
C programmsC programms
C programms
 
Ch8 file processing
Ch8 file processingCh8 file processing
Ch8 file processing
 
C basics
C basicsC basics
C basics
 
week-12x
week-12xweek-12x
week-12x
 
Data Structure Using C - FILES
Data Structure Using C - FILESData Structure Using C - FILES
Data Structure Using C - FILES
 
10〜30分で何となく分かるGo
10〜30分で何となく分かるGo10〜30分で何となく分かるGo
10〜30分で何となく分かるGo
 
C-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdfC-Program Custom Library, Header File, and Implementation FilesI .pdf
C-Program Custom Library, Header File, and Implementation FilesI .pdf
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
PPS Notes Unit 5.pdf
PPS Notes Unit 5.pdfPPS Notes Unit 5.pdf
PPS Notes Unit 5.pdf
 
File handling(some slides only)
File handling(some slides only)File handling(some slides only)
File handling(some slides only)
 
Institute management
Institute managementInstitute management
Institute management
 
Ch3(working with file)
Ch3(working with file)Ch3(working with file)
Ch3(working with file)
 

More from argusacademy

Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
argusacademy
 
Html table
Html tableHtml table
Html table
argusacademy
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
argusacademy
 
Html level ii
Html level  iiHtml level  ii
Html level ii
argusacademy
 
Html frame
Html frameHtml frame
Html frame
argusacademy
 
Html forms
Html formsHtml forms
Html forms
argusacademy
 
Html creating page link or hyperlink
Html creating page link or hyperlinkHtml creating page link or hyperlink
Html creating page link or hyperlink
argusacademy
 
Html basic
Html basicHtml basic
Html basic
argusacademy
 
Php string
Php stringPhp string
Php string
argusacademy
 
Php session
Php sessionPhp session
Php session
argusacademy
 
Php if else
Php if elsePhp if else
Php if else
argusacademy
 
Php creating forms
Php creating formsPhp creating forms
Php creating forms
argusacademy
 
Php create and invoke function
Php create and invoke functionPhp create and invoke function
Php create and invoke function
argusacademy
 
Php array
Php arrayPhp array
Php array
argusacademy
 
Sql query
Sql querySql query
Sql query
argusacademy
 
Rdbms
RdbmsRdbms
Oracle
OracleOracle
Oracle
argusacademy
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
argusacademy
 
Vb.net iii
Vb.net iiiVb.net iii
Vb.net iii
argusacademy
 
Vb.net ii
Vb.net iiVb.net ii
Vb.net ii
argusacademy
 

More from argusacademy (20)

Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
 
Html table
Html tableHtml table
Html table
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
 
Html level ii
Html level  iiHtml level  ii
Html level ii
 
Html frame
Html frameHtml frame
Html frame
 
Html forms
Html formsHtml forms
Html forms
 
Html creating page link or hyperlink
Html creating page link or hyperlinkHtml creating page link or hyperlink
Html creating page link or hyperlink
 
Html basic
Html basicHtml basic
Html basic
 
Php string
Php stringPhp string
Php string
 
Php session
Php sessionPhp session
Php session
 
Php if else
Php if elsePhp if else
Php if else
 
Php creating forms
Php creating formsPhp creating forms
Php creating forms
 
Php create and invoke function
Php create and invoke functionPhp create and invoke function
Php create and invoke function
 
Php array
Php arrayPhp array
Php array
 
Sql query
Sql querySql query
Sql query
 
Rdbms
RdbmsRdbms
Rdbms
 
Oracle
OracleOracle
Oracle
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
 
Vb.net iii
Vb.net iiiVb.net iii
Vb.net iii
 
Vb.net ii
Vb.net iiVb.net ii
Vb.net ii
 

Recently uploaded

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
Krisztián Száraz
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Advantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO PerspectiveAdvantages and Disadvantages of CMS from an SEO Perspective
Advantages and Disadvantages of CMS from an SEO Perspective
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 

C programming file handling

  • 5. #include<stdio.h> void main() { char ch; FILE *fptr; fptr =fopen("c:myfile.txt","a"); printf("Enter the data to be stored in a filen"); while((ch=getchar())!=EOF) { fputc(ch,fptr); } fclose(fptr); fptr=fopen("c:myfile.text","r"); while((ch=fgetc(fptr))!=EOF) { printf("%c",ch); } fclose(fptr); } EXTRA
  • 7. #include<stdio.h> void main() { char ch; FILE *fp; fp=fopen("sample.txt","w"); printf("Input a character::n"); while((ch=fgetc(stdin))!=EOF) { fputc(ch,fp); } fclose(fp); fp=fopen("sample.txt","r"); while((ch=fgetc(fp))!=EOF) printf("%c",ch); } EXTRA
  • 10. #include<conio.h> void main() { FILE *fp; char s[100]; fp=fopen("text.txt","w"); if(fp==NULL) { puts("cannot open a file"); exit(1); } printf("Enter a text (type end to stop):n"); while(strcmp(gets(s),"end")!=0) { fputs(s,fp); } fclose(fp); fp=fopen("text.txt","r"); if(fgets(s,10,fp)!=NULL) { printf("%s",s); } } EXTRA