This document discusses file handling in C programming. It describes the high level and low level methods of performing file operations in C using functions like fopen(), fclose(), getc(), putc(), fprintf(), fscanf(), getw(), putw(), fseek(), and ftell(). It explains how to open, read, write, close and perform random access on files. Functions like fopen(), fclose() are used to open and close files while getc(), putc(), fprintf(), fscanf() are used to read and write data from files.
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
Contents:-
Introduction
What is a File?
High Level I/O Functions
Defining & Opening a File
Closing a File
The getc and putc Functions
The getw and putw Functions
The fprintf and fscanf Functions
Text Input / Output: Files, Streams, Standard Library Input / Output Functions, Formatting Input / Output Functions, Character Input / Output Functions, Binary Input / Output: Text versus Binary Streams, Standard Library, Functions for Files, Converting File Type
This video has covered FILES chapter in Data Structure using C for BCA II semester, as per syllabus prescribed by Karnatak University , Dharwad,Karnataka,INDIA.
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
File Operation such as
Reading the file content
Writing the content to the file
Copying the content from one file to another file
Counting the number of character, words and lines of the file
Wherever there is a need to handle large volumes of data, it is advantageous to store data on the disks and read whenever necessary. This method employs the concept of files to store data. A file is a place on disk where a group of related data is stored.file handling c programming tutorial
COURSE TITLE: SOFTWARE DEVELOPMENT VI
COURSE CODE: VIT 351
TOPICS COVERED:
FILES
FILES I/O STREAM
TYPES OF FILES
DRAWBACKS OF TRADITIONAL METHOD OF DATA STORAGE
CONCEPT OF BUFFER
MODES OF FILE OPENING
END OF FILE
PROCESSORS DIRECTIVES
MACROS
TYPES OF MACROS
DIFFERENCE BETWEEN MACROS AND FUNCTIONS
QUIZ SET 5
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
Pushing the limits of ePRTC: 100ns holdover for 100 daysAdtran
At WSTS 2024, Alon Stern explored the topic of parametric holdover and explained how recent research findings can be implemented in real-world PNT networks to achieve 100 nanoseconds of accuracy for up to 100 days.
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Climate Impact of Software Testing at Nordic Testing Days
Unit5
1. FILE HANDLING IN ‘C’
Disk I/O functions
High level Low level
Text Binary
Formatted Un formatted formatted Un formatted
2. This works fine as long as the data is small.However, many real
life problems involve large volumes of data and in such
situations, the console oriented I/O operations pose two
major problems.
1. It becomes cumbersome and time consuming to handle large
volumes of data through terminals.
2. The entire data is lost when either the program is terminated
or computer is turned off.
o It is therefore necessary to have a more flexible approach
where data can be stored on the disks and read whenever
necessary, without destroying the data.
o The method employs the concept of files to store data. A file
is place on the disk where a group of related data is stored.
3. Like most other languages, c supports a number of functions
that have the ability to perform basic file operations, which
include.
naming a file
opening a file
reading data from a file
writing data to a file and
closing a file.
There are two distinct ways to perform file operations.
--The first one is known as the low level I/O and uses
UNIX system calls.
--The second method is referred to as the high level
operation and uses functions in c standard I/O library.
4. HIGH LEVEL I/O FUNCTIONS
fopen () creates a new file for use.
Opens an existing file for use.
fclose() closes a file which has been opened for use.
getc() reads a character from a file .
putc() writes a character to a file.
fprintf() writes a set of data values to a file.
fscanf() reads a set of data value from a file.
getw() reads an integer from a file.
5. putw() writes an integer to a file.
fseek() sets the position to a desired point in the file.
ftell() gives the current position in file.
rewind() sets the position to beginning of the file.
DEFINING AND OPENING A FILE:
If we want to store data in a file in the secondary memory, we must
specify certain thing about a file to operating system they are
1.File name 2. data structure 3. purpose
For file name general format of declaring and opening a file is
FILE *fp; specifies the file name.
fp= fopen (“ Filename”, “mode”); specifies the purpose of file.
6. The mode does this job. Mode can be one of the following
r: opens the text file for reading only.
w: opens the text file for writing only.
a : open the file for appending data to it.
r+: the existing file is opened for both reading and writing.
w+ : this mode allow you to open a file as text file for
reading as well as writing a data to a file.
a+ : this mode allows you to open a file as a text file for
both reading and writing to a file.
One other hand we need to add ‘b’ for binary file i.e., rb,
wb, rb+, wb+, a, ab+, ab.
7. rb: this mode allows to open a file as a binary file for reading
data from it.
wb: this mode allows to open a file as a binary file for writing
data to it.
ab: this mode allows to open a file as a binary file for
appending data at the end of the file.
rb+: this mode allows to open a file as a binary file for reading
as well as writing data to a file.
wb+ : this mode allows to open a file as a binary file for writing
data to a file.
ab+: this mode allows to open a file as a binary file for both
reading and writing data to a file.
8. Example:
FILE *P1, *P2;
P1= fopen (“data.c”, “r”);
P2= fopen (“result.c”, “w”);
CLOSING A FILE:
A file must be closed as soon as all operations on it
have been completed. This ensures that all outstanding
information associated with the file is flushed out from the
buffer and all links to a file are broken.
Syn: fclose ( file pointer);
fclose (P1);
9. getc() and putc():
The getc() is an input function is used to read a single
character from a file.
Syntax : charvar=getc (file pointer);
ch=getc (fp);
The putc() is an output function used to write a single
character into a file.
Syntax : putc (charvar, file pointer);
putc (ch, fp);
10. Program to count character, spaces, tabs, and numbers in a file.
#include<stdio.h>
Void main()
{ char ch;
int nol=0, not=0, nos=0, noc=0;
fp=fopen(“pri.c”, “r”);
while(1)
{ ch=getc (fp);
if ( ch== EOF)
break;
noc++;
11. if ( ch==‘ ‘)
nos++;
if (ch== ‘t’)
not++;
If ( ch==‘n’)
nol++;
}
fclose (fp);
printf (“ number of characters = %d”, noc);
printf (“ number of blanks= %d n”, nos);
printf (“ number of tabs=%d n” , not);
12. printf (“ number of lines = %d n”, nol);
getch();
}
OUTPUT:
number of characters =125
number of blanks =25
number of tabs =13
number of lines =22
13. putw() and getw():
The putw() function is an output function and is used
to write an integer into a file.
Syntax: putw( integer, file pointer)
ex: putw (x,pf);
The getw() function is an input function and is used to read
an integer from a file.
Syntax: integervar =getw( file pointer);
ex: x= getw(fp);
14. Program for demonstrating putw() and getw() function
#include<stdio.h>
#include<stdlib.h>
Void main()
{
FILE *f;
int word1, word2;
fp=fopen ( “ number.c”, “w”);
if(fp==NULL)
{
printf (“ error opening file”);
20. printf(“ the student record n”);
fscanf (fp, “%d %s %f”, &rno, name, &marks);
printf(“ %d %s %f”, rno, name, marks);
fclose (fp);
} scanf()
H.D
Enter students
fprintf()
student rno name marks
1 ravi 1.Ravi 30.5
30.5
1. Ravi 30.5
1 ravi 30.5
fscanf() prinf()
21. RANDOM ACCESS TO FILES:
Sometimes it is required to access only a particular part
of the file and not the complete file.
This can be accomplished by using following function.
fseek(): it is a file function. It positions file pointer on the
stream. We can pass three arguments through this
function.
The general format of fseek function is as follows:
fseek( file pointer, offset, position);
This function is used to move the file position to a desired
location within the file.
22. 1. Fileptr is a pointer to the file concerned.
2. Offset is a number or variable type long.
3. Position in an integer number.
Offset specifies the number of positions (bytes) to be moved
from the location specified at position.
integer
Constant Location in file
value
0 SEEK_SET Beginning of file
1 SEEK_CUR Current position of file
2 SEEK_END End of file
Ex: fseek(fp,10,0) or fseek(fp, 10,SEEK_SET)
filepointer is repositioned in forward direction by 10 bytes
23. Program to read the text file containing some
sentence. Using fseek() and read the text after skipping
‘n’ character from beginning of file.
Void main()
{
FILE *fp;
int n, ch;
clrscr();
fp=fopen( “ text.txt”, “r”);
printf( “n contents of file n”);
while ((ch=fgetc(fp))!=EOF)
printf(“ %c”, ch);
24. printf( “ n how many characters including spaces
would you like to skip?”);
scanf(“%d”, &n);
fseek ( fp, n, SEEK_SET)
printf(“n information after %d byte n”,n);
while (( ch=fgetc(fp)) !=EOF)
printf(“%c”, ch);
fclose(fp);
}