L10 storing data in file

Page 1

emeronTI10 ³

rkSarTukTinñn½ykñúg

File

I. Definition file:

CasMNuMénTinñn½y EdlmanTMnak;TMngCamYyKña nigmanRbePTdUcKñaRtUv)an pþúMbBa©ÚlKñabegáIt)an Ca array of data . file RtUv)anpÞúkkñúg Disk … . File

II. Analysis file:

bNþaCMh‘anedIm,I analysis file rYmman ³ -

Declaration file variable : Open file for read or write : Read file, write file : Close file.

II.1). Declaration file variable:

eyIgkMNt;eRbI fptr CaeQμaH pointer file edIm,IeFVICa]TahrN_ . kñúgCak;Esþg/ eyIgGacCMnYs fptr edayeQμaHNaepSgeTotk¾)an . Statement Declaration man Syntax dUcxageRkam ³ FILE *fptr ;

- FILE Ca Keyword Canic©CakalRtUvEtman nigsresrCaGkSrFM . - sBaØa * bBa¢ak;fa pointer .


II.2). Open file for write or read : Syntax open file for write: fptr = fopen (“filename” , “w” ); Syntax open file for read : fptr = fopen (“filename” , “r” );

]TahrN_³ ebIk file fμIedIm,I write data (eday file maneQμaH nig path) fptr = fopen (“c:\\TC\\ EXAM.TXT”, “w”);

RbePT analysis file manragdUcxageRkam ³ - cMeBaH text file : “r” : ebIk file EdlmanRsab;sMrab; read (“read only”) . “w” : ebIk file fμIedIm,I write (“write only”), ebIeQμaH file dUceQμaH file cas;enaH file cas;RtUv)anlb;ecal . “a” : ebIk file EdlmanRsab;sMrab; write EfmTinñn½y . “r+” : ebIk file EdlmanRsab;sMrab; read nig write . “w+” : ebIk file fμIedIm,I write nig read “a+” : ebIk file EdlmanRsab;sMrab; read nig write EfmTinñn½y - cMeBaH binary file : “rb” : ebIk binary file EdlmanRsab;sMrab; read, “read only,binary file +

”.

ebIk binary file fμIedIm,I write, “writing only, binary file” “ab” : ebIk binary file EdlmanRsab;sMrab; write data Efm “r+b” : ebIk binary file EdlmanRsab;sMrab; read nig write “w+b”: ebIk binary file fμIsMrab; read nig write “ wb”:

204


“a+b” :

ebIk binary file EdlmanRsab;edIm,I write EfmTinñn½yfμI

II.3). Read file nig Write file :

kñúgCMh‘anenHmanPaBxusKñarvagbNþaRbePTrbs; file nigRbePT dUecñHeyIgRtUv sikSakñúg]TahrN_CamYybNþa function write, read .

analysis

file

.

II.4). Close file:

CakargarcugeRkayeKbg¥s;kñúgkar analysis file . manrag ³

Close file fclose (fptr);

# include <stdio.h> main ( ) {FILE *fptr; fptr = fopen (“sample.dat”, “w”); if (fptr = = NULL) printf (“\n ERROR – Cannot open”); else { … /* analysis file */; … fclose (fptr); } }

III. Binary file : III.1) eRkayBIebIk file

fμICamYy analysis file “w”(writing), dMbUgenaH file TeT eRBaHminTan; manFatuNaTaMgGs;/ eBlenaH pointer file nwg point to cug file KW (EOF) . xageRkayenHCa]TahrN_begáIt file man !00 Fatu EdlmantMélBI ! dl; !00 . ]TahrN_ ³ begáIt file éncMnYnKt; ³ # include <stdio.h> # include <conio.h> main ( ) { char filename[21]; int i; long num; FILE *f1; printf (“\n Name file:”); scanf (“%20s”, &filename); f1 = fopen (filename, “wb”); /*open file for writing only */ /* write 100 number into file */

205


for ( i = 1; i <= 100; i ++) fwrite (&i, sizeof (int), 1, f1); fclose(f1); } Note: fwrite (&i, sizeof (int), 1, f1); -

Function

enHmanskmμPaB

eTAkñúgfile(file

writedata

write)

manbNþa

parameters

dUcxageRkam + &i: address of Variable i

TMhMrbs;

EdlRtUv write eTAkñúg file

+ data + Address of file

cugeRkayKW pointer of file fwrite GnuBaØatþieGay write data CaeRcInEdlmanTMhMb:unKña/ eTAkñúg file )an . + fopen ( ): GacmantMélesμI NULL, kñúgkrNImankMhusdUcCa disk full . +

-

Ex: printf (“Name file:”); scanf (“%20s”, filename); f1 = fopen (filename, “wb”);

eyIgGacCMnYseday statement: f1 = fopen (“Integer.Dat”, “wb”);

III.2) Read binary file:

edIm,I Read FatuNamYyrbs; file RtUvmanlkçx½ N ½ ³ etI file enaHenAmanFatusrM ab; Read

b¤Gt; ? . Function feof ( ) nwgR)ab;eGaydwg³ ebI Read dl;cug file enaH feof ( ) = True pÞúyeTAvij feof ()= False . Ö viFanedIm,I Read file mYyeyIgeRbI ³ eBl Read file, RtUv Read Fatu file CamuneTIbRtYtBinitüemIl etIFatuenaHCa EOF b¤Gt; ? (pointer Æ EOF)

if ((ch = getc (fp)) != EOF)...

kñúgenaH function getc (fp) Ca function Read 1 character b¤ 1 byte rbs; file Edlman pointer fileKW fp. statement enHmann½yfa Read 1 character BI file fp 206


nigBinitüemIltMélrbs;vaesμI EOF b¤ Gt; ? edIm,IRtYtBinitüRKb;FatuTaMgGs;rbs; file EdleyIg Read .

b¤eRbI

while ((ch = getc (fp)) != EOF) ...

enaHnwg Read FatuTaMgGs;rbs; file rhUtdl; EOF eTIbQb; . Ex: Read file of integer number : #include <stdio.h> main ( ) { char filename[21]; int i; FILE *f1; printf (“”\n Name file:”); scanf (“%20s”, &filename); f1 = open (filename, “rb”); while (fread (&i, sizeof (int), 1, f1), !feof (f1)) printf (“\n%d”, i); fclose (f1); } Note: Statement while (fread(&i, sizeof(int),1, f1),!feof(f1)) printf(“\n%d”, i);

Gnuvtþn_kar Read tMél i, eRkaymkRtYtBiinitüemI;l EOF ehIyb¤enA . syntax: while (Expression 1, Expression2) <Actions>;

smmUlnwg do { Expression 1; if (Expression2) <Action>; } while (Expression2);

dUecñHkñúgkmμviFIxagelIGacsresrdUcxageRkam ³ do {

fread (&i, sizeof (int), 1, f1); if (!feof (f1)) printf (“\n%d”, i); } while (!feof (f1));

-

b¤ ebIeyIgdwgcMnYnFatuCamun enaHeyIgsresr for ( i = 1; i <= 100; i++) fread (&i, sizeof (int), 1, f1);

-

kMuePøc open file data RbePT binary “rb” . 207

Loop

while


\LÚveyIgeFVI]TahrN_Cak;Esþg: ]bmafaman file INTEGER.Dat pÞúkcMnYnBI! dl;!00. eyIg Read FatuTI!nigTI#én file xagelIehIytageGay Variable A,B. Exam: Read 3cMnYnKt;:

#include<stedio.h> #include<conio.h> main( ) { int A,B; long num; FILE *f1; f1=fopen(“Integer.DAT”,”rb”); fread (&A, sizeof (int),1,f1); fread (&B, sizeof (int),1,f1); fread (&B, sizeof (int),1,f1); printf (“\n A=%d”,A); printf (“\n B=%d”,B); fclose (f1); getgh( ); return 0; }

BI file éncMnYnKt;eTA file epSgeTot. kmμviFIsresreRkamrag Function: Example: Copy

Ex: copy file of integer: #include < stdio.h> #include < conio.h> main( ) { char filename1 [21]; char filename2 [21]; int i; FILE *f1,*f2; printf (“Name file source:”); scanf (“%20s”,&filename1); f1=fopen (filename1,”rb”); prinf (“Name file destination :”); scanf (“%20s”,&filename2); f2=fopen (filename2, “wb”); while (fread(&i, sizeof(int),1,f1),! feof (f1)) { fwrite (&i, sizeof(int),1,f2); 208


} f close (f1); f close (f2); return 0; }

III.3/ write-read file Edlman Data RbePT struct :

begáIt

EdlmanTinñn½yCa

Example: file struct: #include<stdio.h> #include<conio.h> #include<string.h> #define TRUE 1 char ss[80]; typedef struct { int day; int month; int year; } date; typedef struct { char name[80] ; int homenum; char street[80] ; char city[30] ; float salary; date dob; } person; person read_screen (person poeple); FILE *fpt; main( ) {int flag = TRUE; person poeple; fpt = fopen (“LIST.DAT”,”wb”); person. salary = 0; while (flag) { printf (“\n Name:”); gets (people. name); if (people. name[0]= = ‘\0’) break; people = read_screen(people); fwrite (&people, sizeof (person),1,fpt); } fclose (fpt); }

209


*/ ------------------- */ person read_screen (person people) { printf (“Enter day/ month/ year : ”); scanf (“%d%d%d”, &people.dob.day, &people.dob.month, &people.dob.year); printf (“Home number : ”); scanf (“%d”, &people.homenum); gets (ss); /* or while (getch ( ) ! = ‘\n’); */ printf (“City : ”); gets (people.city); printf (“Street : ”). gets (people.street); printf (“Salary :”); scanf (“%f”, &people.salary); gets (ss); return (people); } Exam: read data from file struct :

munnwg read file of struct eyIgRtUvdwg RbePTTinñn½yrbs; field nImYy² >>> # include <stdio.h> # include <conio.h> # include <string.h> #define TRUE 1 typedef struct { int day; int month; int year; } date; typedef struct { char name[80]; int homenum; char street[80]; char city[30]; float salary; date dob; } person; void write_screen (person); FILE *fpt; main ( ) { person people; fpt = fopen (“LIST.DAT”, “rb”);

210

struct

enaHCamun³ man

field

NaxøH ?


while (fread (&people, sizeof(person), 1, fpt), !feof (fpt)) { write_screen (people); } fclose (fpt); return 0; } void write_screen (person people) { printf (“Name :%s \n”, people.name); printf (“Date of birth :%2d/ %2d/ people.dob.day,people.dob.month,

%2d

\n”,

people.dob.year); printf (“Home number :%d \n”, people homenum); printf (“Street :%s \n”, people.street); printf (“City :%s \n”, people.city); printf (“Salary :%8.2 f\n\n”, people.salary); }

kñúg]TahN_xagelI/ eyIgKb,IcMNaMkar Declaration nig open file edIm,I read CamYy “rb”, nig open file edIm,I write CamYy “wb” . Note:

IV. Access edaypÞal;eTAFaturbs; file binary :

kñúg C edIm,I access edaypÞal;eTAFatuNamYyrbs; file eyIgeRbI fseek : fseek (fptr, No*sizeof(one_record), SEEK_SET); Note:

Ca pointer file, vaGacmaneQμaHepSg² >>> + No: CaTItaMgénelxerogrbs;Fatukñúg file . ¬FatuTImYyrbs; file manelxerog (index) esμI 0) EteBleyIgeRbIKWcab;epþImBIelx 1 . + sizeof(onerecord), eRcInEtGnuvtþn_eday function sizeof ( ) . dUecñHkenSam ³ + fptr:

No *sizeof(onerecord) ; + parameter statement

cugeRkaykñúg man3 krNI³ SEEK_SET (b¤ 0) rMkilKNnaTItaMg access cab;BIedIm file 211


b¤ rMkilKNnaBITItaMg current pointer file eTAcug file . SEEK_END (b¤ 2) rMkilKNnaBIcug file mkvij eyIgnigRsavRCavkar Access edaypÞal;eTAkñúg file + Read data from Keyboard nig create new SEEK_CUR ( 1)

+ Read again data from file. + Update, data ... Ex: Access file

edaypÞal;/ edIm,I Read : ]bmaeyIgman file énbNþacMnYnKt; nwgcg; access edaypÞal;edIm,I Read FatuTI No : # include <stdio.h> #include <conio.h> main ( ) { char filename[21]; int n; int No; FILE *f1; printf (“ Name file:”); scanf (“ %20s” , filename); f1 = fopen (filename, “ r” ); while (printf (“No :”),scantf (“ %d”,&No) {fseek (f1, size(int) *(No-1), SEEK_SET); fread (&n, sizeof (int), 1, f1); printf (“ Value find is : %d \n”, n); } fclose(f1); getch(); } Note:

]TahrN_xagelIGnuBaØatieGayeyIg Read edaypÞal; Value énFatuNamYykñúg file . Ex: access edaypÞal;edIm,I update data: # include <stdio.h> #include <conio.h> main ( ) { char filename[21]; int n; long num; FILE *f1; printf (“ Name file :” ); scanf (“ %20s”,filename) f1 = fopen (filename,” w”); while (printf (“No :”), scanf(“ %d”, &num),num)

212


{printf (“value update:” ); scanf (“ %d”, &n); fseek (f1,sizeof (int)*(num –1), SEEK_SET); fwrite (&n, sizeof (int), 1,f1); } fclose(f1); }

edaypÞal;

nig

Ex: access : write read: # include <stdio.h> #include <conio.h> int main (vod) { FILE *strem; char msg[ ] = “ this is a program for example !”; char buf[20]; if ((stream = fopen (“ DUMMY.FIL”, “w+” )) == NULL) { fprintf (stderr, “cannot open output file.\n”); return 1; } fwrite (msg,strlen (msg) +1, 1, stream); fseek (streem, SEEK_SET, 0); fread (buf,strlen(msg) +1, 1, stream); printf (“ %s\n”, buf); fclose (stream); return 0; }

xagelI³

Ex: update file struct (file LIST.DAT) : # include <stdio.h> #include <conio.h> # define TRUE 1 typedef struct { int day; int month; int year; } date; typedef struct { char name[80]; int homenum; char street[80]; char city[30]; float salary; } person; void write_screen (person); FILE *fpt; main ( ) { person people;

213


int No; long size, pos; fpt = fopen (“LIST.DAT”, “rb”); fseek (fpt, 0, SEEK_END); size = ftell(fpt); printf (“No :”); scanf (“%d”, &No); pos = No *sizeof (person); if (No < 0 || pos > size) printf (“\nHave no record in file”); else { fseek (fpt, pos –1, 0); fread (&people, sizeof (person), 1, fpt); write_screen (people); } } void write_screen (person people) {

dUcxagelI}

IV.1. Text Files :

bNþaFaturbs; Text file KWCabNþa characters, string, text . bNþa Function write eTAkñúg text file : putc (ch, fptr); write 1 character eTAkñúg text file fputs (str, fptr); write string eTAkñúg text file fprintf (fptr,...); smmUl printf ( ) Ex: write string énbNþa GkSrFMeTAkñúg file: kmμviFIenH Read 1 bnÞat; character BI keyboard nig write eTAkñúg text file: # include <stdio.h> main ( ) { FILE *fpt; char c; fpt = fopen (“c:\\tc\\sample.Dat”, “w”); do { putc (toupper (c = getchar ( ) ), fpt); } while (c! = ‘\n’); fclose (fpt); }

ª cMNaM enHCa Function KNna text file. . Statement putc R)ab;eGayeyIgdwgfaenHCa file text

. Ca statement write 1 character eTAkñúg text file . 214


ªStatement openfile : fpt = fopen (“c:\\tc\\sample.dat”, “w”);

IV.2.Read data from text file :

edIm,IebIk file text : fopen (..., “r”); “r” Read only Read data from text file : Read file file getc (fptr); Read charater form text file fgets (str, fptr); Read string str text file fptr

cMNaM ³

mann½yfa

kar

bNþaFatuBI

eRkayBIebIk

bNþa

BI

ehIy ³

BI

smmUl

.

fscanf ( ); Read Value text file, scanf ( ); # include <stdio.h> main ( ) { FILE *fpt; char c; if ((fpt = fopen (“C:\\TC\\sample.DAT”, “r”)) == NULL) printf (“\a\n Erro, Cannot open file”) else do { putchar (c = getc (fpt)); } while (c! = ‘\n’); fclose (fpt); } Note :

TMnak;TMngrvagkar Read nig write eTA file : Read getc ( ) Read 1 character fgets ( ) Read 1 scanf ( )

Write putc ( ) write 1 character fputs ( ) write 1 fprintf ( )

mþg mþg bnÞat;

mþg mþg bnÞat;

215


IV.3.

lMhat;Gnuvtþ ³

]TahrN_xageRkamGFib,ayBIkar write nig Read bNþa Record eTAkñúg text file .

# include <stdio.h> # include <conio.h> # include <string.h> # define TRUE 1 typedef struct { int day; int month; int year; } date; typedef struct { char name[80]; int homenum; char street[80]; char city[30]; float salary; date dob; } person; person read_screen (person people); void write_file (person people); FILE *fpt; char ss[80]; main ( ) { person people; int flag = TRUE; fpt = fopen (“LIST.DAT”, “w”); people.salary = 0; while (flag) { printf (“\n Name:”); gets (people.name); if (people.name[0] == ‘\0’) break; people = read_screen (people); write_file (people); } fclose (fpt); } person read_screen (person people) { printf (“Enter day /month/ year:”); scanf (“%d%d%d”, &people.dob.day, &people.dob.year) ; printf (“home number :”); scanf (“%d”, &people.homenum); gets (ss); /* or while (getchar ( ) != ‘\n’); printf (“street:”); gets (people.street); printf (“city:”); gets (people.city); printf (“salary:”); scanf (“%f”, &people.salary); gets (ss);

216

&people.dob.month,


return (people); } void write_file (person people). { fprintf (fpt, “%d%d%d\n”, people.dob.day, people.dob.year); fprintf (fpt, “%d\n”, people.homneum); fprintf (fpt, “%s\n”, people.street); fprintf (fpt, “%s\n”, people.city); fprintf (fpt, “%f\n”, people.salary); }

IV.4.

bNþa]TahrN_KNna text :

kñúgEpñkenHeyIgsikSaBIbNþa]TahrN_KNna rab;cMnYnbnÞat;eTAkñúg

file text text file : Ex: text file: # define EOF –1 # define EOL 0x0A /* or ‘\n’ */ int ch, count; ... ch = getch ( ); count = 0; while (ch != EOF) { while (ch != EOL) ch = getchar ( ); count ++; ch = gatchar ( ); }

dUcCa copy file, rab;cMnYnbnÞat;eTAkñúg

b¤sresrmüa:geTotxøICag ³

# define EOF –1 # define EOL 0x0A /* or ‘\n’ */ int ch, count = 0; ... ch = getchar ( ); while ((ch = getchar ( )) != EOF) while ((ch = getchar ( )) != EOL) cout ++; Ex: character file :

rab;cMnYn b¤ KNnaTMhMrbs ; cUrrab;emIlkñúg file mYymanpÞúkb:unμan character ?

# include <stdio.h> # include <conio.h> # include < stdlib.h> main (int argc, char *argv[ ]) { int ch; char filename[20]; FILE *fp; long count = 0; printf (“\n Name file :”); scanf (“%s”,&filename); fp = fopen (filename, “r”); while ((ch = getc(fp)) != EOF)

217

people.dob.month,


{ putc (ch, stdout); /*Display character on screen); count ++; } fclose (fp); printf (“file %s have got %ld character.”, filename, count); return 0; } Note: +

kmμviFIxagelIGnuvtþn_EtcMeBaH text file EdlpÞúk character kñúgtarag code ASCII . + cMnYn character Edl Display on screen ticCagcMnYn byte Cak;Esþgrbs; file . eRBaH Function getc ( ) minrab; character, edImbnÞat; ‘\r’ . function getc ( ) cat;Tuk character ‘\r’ nig ‘\n’ EtmYy character b:ueNÑaH . dUecñHedIm,Irab;eGayRtwmRtUvcMnYn byte kñúg file, enaHeyIgRtUv openfile edIm,I Read Ca “rb”: if ((fp = fopen (argv[1], “rb”)) == NULL) function getc ( ) character

eBlenaH nwgminEbgEck TaMgGs;nigrab; cMnYn byte TaMgGs;kñúg file . VI.

bNþa function KNna

eTotvaKNnaRKb;

character

file rbs; turbo C:

naM cursor file eTATItaMgénFatudMbUgrbs; file Ex: xageRkamnwg Display eLIgvij Gtßn½yrbs; file EdleTIbnwgbegáIteLIg . edIm,IeFVIkargarenH dMbUgRtUvnaM cursor file eTATItaMgénFatutMbUg/ bnÞab;mkeRbI function fgets ( ) edIm,I Read eLIgvijbNþa tMélrbs; file . frewind( ):

# include <stdio.h> # include <stdlib.h> # include < conio.h> # include <string.h> main ( ) { char str[80]; FILE *fp; if ((fp = fopen (“TEST”, “w+”)) == NULL) { printf (“Cannot open file .\n”); exit (1); } do { printf (“Enter string:”); gets(str); strcat (str, ‘\n’); /* add new line */

218


fputs (str, fp); } while (*str != ‘\n’); /* Now Read And Display Data of file */ frewind (fp); while (!feof (fp)) { fgets (str, 79, fp); printf (str); } getch ( ); return 0; } + ferror ( ):

kMNt;karKNna file mankMhus b¤Gt; ? - pþl;tMél TRUE ebIman error - pþl;tMél FALSE ebIKμan error eyIgKb,IeRbI ferror ( ) eRkayBI statement KNna file :

Function ferror ( )

- ch = getc (fp); if (ferror (fp))... - putc (ch,fp); if (ferror(fp))... + remove ( ): Function remove ( )

nwg delete file ecjBI disk .

eRbIkñúgkarbþÚreQμaH

+ rename ( ): file : Ex: # include <stdio.h> int main (void) { char oldname[80], newname[80] ; printf (“Enter old file name:”); gets (oldname); printf (“Enter New file name:”); gets (newame); if (rename (oldname, newname) == 0) printf (“Renamed %s to %s.\n”, oldname, newname); else perror (“rename”); return 0; } fflush (stdin) ;

219


+ fflush ( ):

VII.

eRbIsMrab; clear stdin .

bBa¢Ún parameter Ca

Ex: copy file

file eTAeGay function :

BIr³

# include <stdio.h> main (int argc, char *argv[ ]) { FILE *fp; void filecopy (FILE *, FILE *); if (argc == 1) filecopy (stdin, stdout); else while ( -- argc > 0) if ((fp = open (* ++ argv, “r”)) == NULL) { printf (“Cannot open %s \n”, *argv); return 1; } else { filecopy (fp, stdout); fclose (fp); } return 0; } void filecopy (FILE *fpi, FILE *fpo) { int c; while ((c = getc (fpi)) != EOF) }

eyIgGacsresredayrebobmüa:geTotKW ³ # include <stdio.h> # include <stdlib.h> main (int argc, char *argv[ ]) { FILE *in, *out; char ch; if (argc != 3) { printf (“\n fore got namefile:”); exit (1); } if ((in = fopen (argv[1], “rb”)) == NULL) { printf (“Cannot open source file \n”); exit (1); } if ((out = fopen (argv[2], “wb”)) == NULL) { printf (“cannot open destination file.\n”); exit (1); 220


} while (!feof (in)) { ch = getc (in); if (!feof (in)) putc(ch,out); } fclose (in); fclose (out); gatch ( ); return 0; } # include <stdio.h> # include <stdlib.h> main (int argc, char *argv[ ]) { int ch; FILE *fp; long count = 0; if (argc != 2) { printf (“use :%s name file, argv[0]); exit (1); } if ((fp = fopen (argv[1], “r”)) == NULL) { printf (“Cannot open %s”, argv[1]); exit (1); } while ((ch = getc(fp) != EOF) { putc (ch, stdout); count ++; } fclose (fp); printf (“file% have %ld charaacter”, argv[1], count); return 0; }

======*=====

221


sMnYr 1). 2).

?

etIGaceRbI Function gets (fp,...) edIm,I Read bNþacMnYnKt;kñúg file F: int *F ? GaceRbIkmμviFI text Editor edIm,IemIlGtßn½ybNþa file int *F, float *F manb¤Gt; ? eRBaHGVI

3). command TYPE, PRINT

rbs; Dos Gnuvtþn_CamYy file RbePTNa ?

lMhat; sresrkmμviFI create file F3, pÞúkbNþacMnYnKt;/ edayrebobP¢ab; 2 file éncMnYnKt; F1 nig F2 CamYyKña . 2). sresrkmμviFIrab;cMnYn character kñúg text File mYyeQμaH F . 3). KUsb¤sresrkmμviFIbegáIt file éncMnYnmYy/ eday Read bNþacMnYnKt;BI text File mYyeTot . bnÞat; nImYy²rbs; text file GacmanpÞúk b¤KμanpÞúk cMnYnKt;/ b¤manpÞúkbNþacMnYnKt;mYycMnYn . 5). sresrkmμviFIbegáIt text file pÞúkeQμaH/ Gayu/ GaRs½ydæan rbs;Gñk . eRkaymkkmμviFInwg Read file enHeLIgvijedIm,I print eTA printer Gtßn½yxagelI ¬edaymnusSmñak;enAelIbnÞat;Et1¦ . 6). kñúgeBl open file fμIeyIgkMBug open, enaH file cas;RtUv)anlb;ecal . cUrrkviFanNaedIm,IebICYb krNI enHeGayvaR)ab;eyIgfa/fileenHmanRsab;enAelI Disk ehIy/Gñkk¾cg;lubvaecaledIm,IbegáItfμI b¤Gt; ? 7). sresrkmμviFIKNnacMnYnbnÞat;Edlmankñúg text file mYy . 8). sresrkmμviFI Display bNþa file TaMgGs; . eRkaymkeyIgGaclub file NamYyEdleyIgcg;lub . 9). sresrkmμviFIbþÚreQμaH file . mann½yfa RtUvsresr rename man Read parameter . 10). ]bmaman file text, EdlbNþabnÞat;nImYypÞúkBI 1dl; 100 character cUrsresrkmμviFIbegáIt file fμImYyEdlbNþabnÞat;rbs;vapÞúkRtUv 100 character, bNþa character Read from keyboard 1).

222


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.