SlideShare a Scribd company logo
Cpu(2110003)
Group Project
β€œ12.File Management”
Branch : Mech I-3
Prepared By: Jani Parth U.(150120119051)
Jerin Sibi.(150120119052)
Joshi Parth.(150120119053)
Guided By: Prof. Raxit Jani
INTRODUCTION
 Until Now We Have Been Using The Function Such As Scanf
And Printf To Read And Write Data. These Are Console
Oriented I/O Functions, Which Always Use The Terminal As
The Target.
 The Console Oriented I/O Pose Two Major Problem:
1. It Becomes Complex And Time Consuming To Handle Large
Volume Of Data Through Terminal.
2. The Entire Data Is Lost When Either The Program Is
Terminated.
A File Is A Place On The Disk Where A Group
Of Related Data Is Stored. Like Other
Language C Supports A Number Of Function
That Has The Ability To Perform Basic File
Operation, Which Include:
1. Naming A File
2. Opening A File
3. Reading Data
4. Writing Data
5. Closing A File
FUNCTION NAME OPERATION
οƒ˜ fopen() οƒΌ Creates a new file for use.
οƒ˜ fclose() οƒΌ Close a file which is open for use.
οƒ˜ getc() οƒΌ Reads a character from file.
οƒ˜ putc() οƒΌ Writes a character to a file.
οƒ˜ fprint() οƒΌ Writes a set of data values to the file.
οƒ˜ fscanf() οƒΌ Reads a set of data value from a file.
οƒ˜ getw() οƒΌ Read an integer from the file.
HIGH LEVEL I/O
FUNCTION
DEFINING AND OPENING A FILE
οƒ˜If we want to store data in a file in the secondary memory,
we must specify certain things about the file. They include:
1) FILENAME
2) DATA STRUCTURE
3) PURPOSE
DATA STRUCTURE OF A FILE IS DEFINED AS FILE. FOLLOWING is
the general format for declaring and opening a file.
 FILE *fp;
 fp = fopen(β€œfilename” , β€œmode”);
CLOSING A FILE
A file must be closed as soon as operation on it have
been completed. Another instance where we have to
close a file is when we want to reopen it.
The I/O library supports a function to do this for us. It
takes the following forms:
fclose(file_ pointer);
GETC AND PUTC FUNCTION
 The simplest file I/O functions are getc and putc. These are
the getchar and putchar functions and handle one character
at a time. The statement:
putc(c , fp1);
 Similarly, getc is used to read the character from a file that
has been opened in read mode. The statement:
c= getc(fp2) ;
GETW AND PUTW FUNCTION
The getw and putw are integer-oriented functions.
They are similar to the getc and putc functions
and are used to read and write integer values. The
general form are:
putw(integer ,fp);
getw(fp);
THE fprintf and fscanf FUNCTION
οƒ˜ The function fprintf and fscanf perform I/O operation that
are identical to the familiar printf and scanf functions,
except of course that they work on files. The general form:
fprintf(fp , β€œcontrol strings” ,list);
οƒ˜ The list may include constant, variable and strings. The
general format of fscanf is:
fprintf(fp , β€œcontrol strings” ,list);
ERROR HANDLING DURING I/O OPERATOR
It is possible an error may occur during I/O
operation on a file. They are:
1) Trying to read beyond the end- of- line mark.
2) Device overflow
3) Trying to use a file that has not been opened.
4) Trying to perform an operation on a file, when
the file is opened for another type of operation.
5) Opening a file with an invalid filename.
6) Attempting to write to a write-protected file.
RANDOM ACESS TO FILE
It can be achieved with the help of the functions fseek,
ftell, and rewind available in the I/O library.
Ftell takes a file pointer and return a number of type
long, that corresponds to the current position.
n = ftell(fp);
Rewind takes a file pointer and resets the position to
the start of the file.
rewind(fp);
n = ftell(fp);
fseek function is used to move the file position to a
desired location within the file.
fseek(file_ ptr , offset, position);
COMMAND LINE ARGUMENT
 It’s a parameter supplied to a program when the program is
invoked. For example , if we want to copy the contents of a file
X_FILE to another named Y_FILE, then:
C > PROGRAM X_ FILE Y_ FILE
 Where PROGRAM is the filename where the executable code of
the program is stored.
File Management

More Related Content

PDF
File handling C program
PPTX
file management in c language
PDF
File_Management_in_C
PPTX
File Management in C
PPTX
File handling in C
PPT
File Management
PPTX
File Management in C
PPTX
File handling in c
File handling C program
file management in c language
File_Management_in_C
File Management in C
File handling in C
File Management
File Management in C
File handling in c

What's hot (20)

PPTX
File management in C++
PPT
File in c
PPTX
File handling in C by Faixan
PPTX
File Handling in C
PPT
File in C Programming
PPTX
File handling in C
PPT
Lecture 20 - File Handling
PPT
Mesics lecture files in 'c'
PDF
FILES IN C
PPT
File handling in c
PPT
File handling in c
PPSX
1file handling
PPTX
PPT
File handling-c programming language
PPT
File handling-c
PPT
File handling
PPT
file
PPTX
6. chapter v
File management in C++
File in c
File handling in C by Faixan
File Handling in C
File in C Programming
File handling in C
Lecture 20 - File Handling
Mesics lecture files in 'c'
FILES IN C
File handling in c
File handling in c
1file handling
File handling-c programming language
File handling-c
File handling
file
6. chapter v
Ad

Similar to File Management (20)

PPTX
File management
PDF
14. fiile io
DOCX
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
PPT
How to do file-handling - in C language
PPSX
File mangement
PPT
Unit5
PDF
File Handling in C Programming
PPTX
File handling in c
PPT
7.0 files and c input
PPT
File handling-dutt
PPTX
File management
PPTX
C-Programming File-handling-C.pptx
Β 
PPTX
C-Programming File-handling-C.pptx
Β 
PPTX
File in C language
PPTX
PPS PPT 2.pptx
PPTX
want to learn files,then just use this ppt to learn
PPT
C-Programming Chapter 5 File-handling-C.ppt
PPTX
Concept of file handling in c
PPTX
File Handling in C Programming for Beginners
File management
14. fiile io
C UNIT-5 PREPARED BY M V BRAHMANANDA REDDY
How to do file-handling - in C language
File mangement
Unit5
File Handling in C Programming
File handling in c
7.0 files and c input
File handling-dutt
File management
C-Programming File-handling-C.pptx
Β 
C-Programming File-handling-C.pptx
Β 
File in C language
PPS PPT 2.pptx
want to learn files,then just use this ppt to learn
C-Programming Chapter 5 File-handling-C.ppt
Concept of file handling in c
File Handling in C Programming for Beginners
Ad

More from jani parth (20)

PDF
kinematics of 8-axis robot for material handling applications
PPT
hydraulic symbols
PPT
Terminology Of Spur Gear
PPT
CNC Part programming
PPT
Ultrasonic machining
PPT
Vapor-compression refrigeration – Effect of parameter
PDF
Job evolution
PPT
Fillet feature in solid works
PPTX
IC Engine emission
PPT
Rotating unbalance system
PPTX
Effectiveness and number of transfer units for Parallel flow
PPTX
Signal flow graph
PPT
hydraulic jack
PPT
Band brake or band and block brake
PPT
Casting Defects and Manufacturing Processes
PPT
Welded Joint (Theory)
PPT
Reynolds Number And Experiment
PPTX
Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
PPTX
Optical Flat And Optical Square
PPTX
Relative velocities
kinematics of 8-axis robot for material handling applications
hydraulic symbols
Terminology Of Spur Gear
CNC Part programming
Ultrasonic machining
Vapor-compression refrigeration – Effect of parameter
Job evolution
Fillet feature in solid works
IC Engine emission
Rotating unbalance system
Effectiveness and number of transfer units for Parallel flow
Signal flow graph
hydraulic jack
Band brake or band and block brake
Casting Defects and Manufacturing Processes
Welded Joint (Theory)
Reynolds Number And Experiment
Convergence Of Power Series , Taylor And Laurent Theorems (Without Proof)
Optical Flat And Optical Square
Relative velocities

Recently uploaded (20)

PPTX
SAP Ariba Sourcing PPT for learning material
DOCX
Unit-3 cyber security network security of internet system
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PPTX
QR Codes Qr codecodecodecodecocodedecodecode
PPTX
Introuction about ICD -10 and ICD-11 PPT.pptx
PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
international classification of diseases ICD-10 review PPT.pptx
PPTX
Introduction to Information and Communication Technology
PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
PDF
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
PDF
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
PDF
Triggering QUIC, presented by Geoff Huston at IETF 123
Β 
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
Internet___Basics___Styled_ presentation
PPTX
Introduction about ICD -10 and ICD11 on 5.8.25.pptx
SAP Ariba Sourcing PPT for learning material
Unit-3 cyber security network security of internet system
SASE Traffic Flow - ZTNA Connector-1.pdf
QR Codes Qr codecodecodecodecocodedecodecode
Introuction about ICD -10 and ICD-11 PPT.pptx
Paper PDF World Game (s) Great Redesign.pdf
international classification of diseases ICD-10 review PPT.pptx
Introduction to Information and Communication Technology
522797556-Unit-2-Temperature-measurement-1-1.pptx
presentation_pfe-universite-molay-seltan.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Β 
Vigrab.top – Online Tool for Downloading and Converting Social Media Videos a...
πŸ’° π”πŠπ“πˆ πŠπ„πŒπ„ππ€ππ†π€π πŠπˆππ„π‘πŸ’πƒ π‡π€π‘πˆ 𝐈𝐍𝐈 πŸπŸŽπŸπŸ“ πŸ’°
Β 
Triggering QUIC, presented by Geoff Huston at IETF 123
Β 
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Job_Card_System_Styled_lorem_ipsum_.pptx
Introuction about WHO-FIC in ICD-10.pptx
An introduction to the IFRS (ISSB) Stndards.pdf
Internet___Basics___Styled_ presentation
Introduction about ICD -10 and ICD11 on 5.8.25.pptx

File Management

  • 1. Cpu(2110003) Group Project β€œ12.File Management” Branch : Mech I-3 Prepared By: Jani Parth U.(150120119051) Jerin Sibi.(150120119052) Joshi Parth.(150120119053) Guided By: Prof. Raxit Jani
  • 2. INTRODUCTION  Until Now We Have Been Using The Function Such As Scanf And Printf To Read And Write Data. These Are Console Oriented I/O Functions, Which Always Use The Terminal As The Target.  The Console Oriented I/O Pose Two Major Problem: 1. It Becomes Complex And Time Consuming To Handle Large Volume Of Data Through Terminal. 2. The Entire Data Is Lost When Either The Program Is Terminated.
  • 3. A File Is A Place On The Disk Where A Group Of Related Data Is Stored. Like Other Language C Supports A Number Of Function That Has The Ability To Perform Basic File Operation, Which Include: 1. Naming A File 2. Opening A File 3. Reading Data 4. Writing Data 5. Closing A File
  • 4. FUNCTION NAME OPERATION οƒ˜ fopen() οƒΌ Creates a new file for use. οƒ˜ fclose() οƒΌ Close a file which is open for use. οƒ˜ getc() οƒΌ Reads a character from file. οƒ˜ putc() οƒΌ Writes a character to a file. οƒ˜ fprint() οƒΌ Writes a set of data values to the file. οƒ˜ fscanf() οƒΌ Reads a set of data value from a file. οƒ˜ getw() οƒΌ Read an integer from the file. HIGH LEVEL I/O FUNCTION
  • 5. DEFINING AND OPENING A FILE οƒ˜If we want to store data in a file in the secondary memory, we must specify certain things about the file. They include: 1) FILENAME 2) DATA STRUCTURE 3) PURPOSE DATA STRUCTURE OF A FILE IS DEFINED AS FILE. FOLLOWING is the general format for declaring and opening a file.  FILE *fp;  fp = fopen(β€œfilename” , β€œmode”);
  • 6. CLOSING A FILE A file must be closed as soon as operation on it have been completed. Another instance where we have to close a file is when we want to reopen it. The I/O library supports a function to do this for us. It takes the following forms: fclose(file_ pointer);
  • 7. GETC AND PUTC FUNCTION  The simplest file I/O functions are getc and putc. These are the getchar and putchar functions and handle one character at a time. The statement: putc(c , fp1);  Similarly, getc is used to read the character from a file that has been opened in read mode. The statement: c= getc(fp2) ;
  • 8. GETW AND PUTW FUNCTION The getw and putw are integer-oriented functions. They are similar to the getc and putc functions and are used to read and write integer values. The general form are: putw(integer ,fp); getw(fp);
  • 9. THE fprintf and fscanf FUNCTION οƒ˜ The function fprintf and fscanf perform I/O operation that are identical to the familiar printf and scanf functions, except of course that they work on files. The general form: fprintf(fp , β€œcontrol strings” ,list); οƒ˜ The list may include constant, variable and strings. The general format of fscanf is: fprintf(fp , β€œcontrol strings” ,list);
  • 10. ERROR HANDLING DURING I/O OPERATOR It is possible an error may occur during I/O operation on a file. They are: 1) Trying to read beyond the end- of- line mark. 2) Device overflow 3) Trying to use a file that has not been opened. 4) Trying to perform an operation on a file, when the file is opened for another type of operation. 5) Opening a file with an invalid filename. 6) Attempting to write to a write-protected file.
  • 11. RANDOM ACESS TO FILE It can be achieved with the help of the functions fseek, ftell, and rewind available in the I/O library. Ftell takes a file pointer and return a number of type long, that corresponds to the current position. n = ftell(fp); Rewind takes a file pointer and resets the position to the start of the file. rewind(fp); n = ftell(fp); fseek function is used to move the file position to a desired location within the file. fseek(file_ ptr , offset, position);
  • 12. COMMAND LINE ARGUMENT  It’s a parameter supplied to a program when the program is invoked. For example , if we want to copy the contents of a file X_FILE to another named Y_FILE, then: C > PROGRAM X_ FILE Y_ FILE  Where PROGRAM is the filename where the executable code of the program is stored.