Professional Documents
Culture Documents
, LGNSCOE
ysingtheFile
close a file whiclh is already open, we will use fclose(). As we hav already discussed
7taxof it
we will directly head over to the example.
lude <stdio.h
main(){
LE*file:
H= fopen("file2.txt", "w"):
jvitlfile,
"Hello! Welcome to Scaler academy.\n");
klose(tile);
which is to be
In this example. the file is the pointer associated with the file(file2.txt)
file and start pointing to
oxed. After closing the file the file pointer lost the reference of the
ULL.
Conclusion:
husimplement mploy ee
dataose manaqemenh us ing Aes,
st lab Questions
1. What is error handling in C?
2. What is files in C & its uses?
an array?
3. Write a prograin in C to read the file and store the lines into
|Page
NOrme' legasoini Rjendra Khad e
Tage No.
Date
Procal NO -
hot S e rror
handing in anguage
Chere are same other 0904s by mhich ermr
handingq Can be done in C language he
hender Ale "errorh" is MSed toprint the
prrors Using reHurn StOLement fncon
Text ile -
hese are the simples eLes a User Can
orecte cohen deaung cith a
Lsing any simple teXt editor
Use - dt is used for Storgge g aormahon
Ainary File ;
A bindry Ale stores informgton in the
eorm oA the bincry Dumber System and
hence occupies lesS
USe to Store any dato StorageSpace
alriteq eracqmm n o to read the ele &
S5+0 re he nes nto Qn
Progran
Fngme
a e the cantent
of lhe (\n print
: istlen
(hne ine
TZE Cil (Iine gets cEuhile
Fptr
3COnE%s"
s"fnome) %
Alenome
be to the pput f(" Print
i\n"
ninto eine
qnd le the Read \n\n FPrin
LSTZ]; name Char
[RST
2] Line char
(VOi)d nain tnt
deEineLSTZ
\28 define
String
Zh include<
K_stdb.h2 inctude k
S+dioh inalude< #
alrj
Telecommunication
Department of Electronics & Engg., LGNSCOL
Conclusion:
6| Page
Name;- Tejasini Rajendrq snade
Page No.
Date
PractCal No-09
Cnput
EXplanaHan
LE e exp is Conver+ed into
2
5-C
5+6ck Erom
paPCperakor SeantS
2+3
Evalu
eCUt
5)
StoaK inPUsh &
2 2
OPeronds
OPêrC+Or
Ond the apply Stacl From
apea+orpop
t0 an its
Page No.
Date
4 3
2 3
Step: 8
Conclusion:
100
A
30
60 3
2
\50 10
S|Page
Nome - Tejasoini gajendra Khade,
Page No.
Prac cu NO-Lo Date
Exarmple -
2,
2.
SPp
2
Date
2
Step VIII
6O
a) coSt
50 20
20 60
4 6 O
disore Ma+rix
ViS+ed
+eraHon - dis+ance
eilo)oolo
Vi'sited=
TtOratHon 8 4
nd
66
disránce
ViSited =
AteraHOn
O||0 50
dis+ance =
Visiteol
,th Tteoon
go60| fing) dis
distorce =
Visite=