C-and-C++/C4/File-Handling-In-C/Gujarati

From Script | Spoken-Tutorial
Revision as of 14:30, 25 April 2014 by Jyotisolanki (Talk | contribs)

Jump to: navigation, search
Time Narration
00.01 C માં files(ફાઈલ્સ) પરના સ્પોકન ટ્યુટોરીયલમાં સ્વાગત છે.
00.05 આ ટ્યુટોરીયલમાં આપણે શીખીશું કેવી રીતે,
00.08 ફાઈલ ખોલવું.


00.10 ફાઈલમાંથી ડેટા કેવી રીતે વાંચવા .


00.12 ફાઈલમાં ડેટા કેવી રીતે લખવા.


00.15 કેટલાક ઉદાહરણો.
00.17 આ ટ્યુટોરીયલ રેકોર્ડ કરવાં માટે, હું વાપરી રહ્યી છું
00.20 ઉબુન્ટુ ઓપરેટીંગ સીસ્ટમ આવૃત્તિ ૧૧.૧૦,


00.24 gcc અને g++ કમ્પાઈલર આવૃત્તિ ૪.૬.૧.


00.28 ચાલો ફાઈલો ના પરિચય સાથે શરૂઆત કરીએ.
00.31 ફાઈલએ ડેટાનો સંગ્રહ છે.


00.34 It can be a database, a program, a letter or anything. તે એક ડેટાબેસ,પ્રોગ્રામ ,લેટર અથવા કઈપણ હોઈ શકે છે.
00.39 આપણે C વાપરીને ફાઈલ બનાવી અને ઍક્સેસ કરી શકિયે છે.


00.44 હવે આપણે C માં file handling પર એક ઉદાહરણ જોઈએ.


00.48 મેં એક પ્રોગ્રામ લખ્યો છે.
00.50 ચાલો તે જોઈએ.


00.51 નોંધ લો કે ફાઈલનું નામ file.c છે.
00.55 આ પ્રોગ્રામ માં આપણે એક ફાઈલ બનાવીશું અને તેમાં ડેટા લખીશું.


01.01 ચાલો હું કોડ સમજાઉ.
01.03 આ આપણી હેડર ફાઈલ છે.
01.05 આ આપણું main ફંક્શન છે.
01.07 ફાઈલ વેરીએબલ વ્યાખ્યાયિત કરવા માટે આપણે FILE type વાપરીશું.
01.12 FILE variable(ફાઈલ વેરીએબલ) header stdio.h અંદર વ્યાખ્યાયિત કર્યું છે.


01.19 FILE variableફાઈલ વેરીએબલ)'*fpતે પોઈન્ટર છે.


01.22 તે file ની બધી માહિતીને સંગ્રહ કરશે.


01.26 જેમ કે તેનું નામ, સ્થિતિ અને વર્તમાન માહિતી.


01.31 ચાલો આપણી સ્લાઈડ પર પાછા જઈએ .
01.33 હવે આપણે ફાઈલ ખોલવા માટે સિન્ટેક્ષ જોઈશું.
01.37 અહી fopen function સ્ટ્રીમ ખોલે છે.


01.42 પછી તે સ્ટ્રીમ સાથે 'ફાઇલ' જોડશે.


01.44 filenameતે ફાઇલ નામ છે જે આપણે ખોલવા કે બનાવવા માંગો છો .
01.49 આપણે ફાઈલ નામ સાથે પાથ આપી શકીએ છે.


01.53 અને આપણે એક્સટેન્શન પણ આપી શકીએ છે.


01.56 અહીં આપણે ફાઈલની મોડ આપી શકીએ છે.
01.59 ચાલોમોડ્સ ના પ્રકારો જોઈએ :
02.02 W -વાંચવા અને લખવા માટે ફાઇલ બનાવે છે.


02.06 r – ફાઈલ વાંચવા ખોલે છે .


02.09 a – ફાઈલના અંત માં લખવા માટે છે.'


02.12 હવે આપણા પ્રોગ્રામ પર પાછા આવો.
02.15 અહી આપણે write મોડ માં Sample.txt file બનાવીશું.


02.20 આપણે જોઈ શકે છે પાથ આપવામાં આવ્યો છે .


02.23 આપણી ફાઈલડેસ્કટૉપ' પર બનાવાશે '


02.27 પછી આપણે ફાઇલ'માં સ્ટેટમેન્ટો લખીશું.
02.30 "Welcome to the spoken-tutorial" અને


02.32 "This is an test example"


02.34 fprintf આપેલ આઉટપુટ સ્ટ્રીમ પર આઉટપુટ લખે છે.
02.39 ' fclose 'સ્ટ્રીમ સાથે સંકળાયેલ ફાઈલ બંધ કરે છે.
02.43 અને આ આપણું' 'રીટર્ન સ્ટેટમેન્ટ છે.
02.46 હવે Save(સેવ)પર ક્લિક કરો.
02.48 હવે પ્રોગ્રામ એક્ઝીક્યુટ કરીએ
02.50 તમારા કીબોર્ડ પર Ctrl, Alt અને T કી એકસાથે દબાવી ટર્મિનલ વિન્ડો ખોલો.
02.59 કમ્પાઈલ કરવાં માટે, ટાઈપ કરો
03.00 gcc space file dot c space hyphen o space file


03.06 Enter (એન્ટર) દબાવો.


03.07 એક્ઝીક્યુટ કરવા માટે ટાઈપ કરો dot slash'file (./file)


03.11 Enter '(એન્ટર) દબાવો.


03.13 આપણે જોઈ શકીએ છે કે ફાઈલ એક્ઝીક્યુટ થઇ છે.
03.15 હવે આપણે તે તપાસીશું.


03.17 ચાલો home folder.ખોલીએ.
03.20 'home folderવિકલ્પ પર ક્લિક કરો.


03.22 હવે Desktop વિકલ્પ પર ક્લિક કરો.


03.25 અહી આપણી sample.txt ફાઈલ છે.
03.29 આ બતાવે છે કે આપણી ફાઈલ સફળતાપૂર્વક બની ગયી છે.


03.32 ચાલો તે ખોલીએ.
03.34 ફાઈલ પર બે વાર ક્લિક કરો.


03.36 આપણે મેસેજ જોઈ શકીએ છે.


03.39 Welcome to the Spoken Tutorial.


03.41 This is an test example.


03.44 આ રીતે આપણે એક ફાઈલ બનાવી અને તેમાં ડેટા લખ્યો


03.48 હવે આપણે જોશું કેવી રીતે ફાઈલ માથી ડેટા વાંચવા.
03.52 મેં પહેલાહી જ પ્રોગ્રામ લખ્યો છે.
03.54 હું તે ખોલીશ.


03.56 In this program we will read data from our sample.txt file and print the data on the console.


04.03 Let me explain the code now.
04.05 This is our header file.
04.08 This is our main function.
04.10 Here, a file variable and a pointer to the file variable is defined.
04.15 Then we have declared a character variable c.
04.19 Here, we open the file Sample.txt in read mode.
04.24 The output is stored in fp.


04.27 Then we check the condition.
04.29 If fp is equals to NULL.


04.32 If the condition is true, then we print the message:


04.36 "File doesn't exist."


04.38 Else it will check for another condition.
04.41 While c is not equal to EOF.


04.46 Here, EOF is the end of file.


04.49 It denotes the end of input.


04.52 It is a condition where no more data can be read from a data source.


04.57 If the condition is true, then it will display the characters from Sample.txt file, on the console.
05.06 Here, getc returns a character from a specified file or stream.
05.12 Now, it will return a character from our Sample.txt file.


05.17 putchar is used to display a character on the console.
05.22 Then it will store the characters in variable c.


05.25 Here we close the file.
05.28 And this is our return statement.
05.30 Now click on Save.
05.32 Let us execute the program.
05.35 Come back to the terminal.
05.37 To compile, type
05.38 gcc space readfile dot c space hyphen o space read


05.45 Now press Enter


05.47 To execute, type ./read
05.52 The output is displayed as:
05.54 Welcome to the Spoken-Tutorial.


05.56 This is an test example.


05.59 This brings us to the end of this tutorial.
06.01 Come back to our slides.
06.03 Let us summarize.
06.04 In this tutorial we learnt,


06.06 File handling.


06.08 To write data into a file.
06.10 eg. fp = fopen(“Sample.txt”, “w”);


06.17 To read data from a file.


06.18 eg. fp = fopen(“Sample.txt”, “r”);


06.25 As an assignment,
06.26 Write a program to create a file TEST.


06.30 Write your name and address in the file TEST.
06.33 Then display it on the console using C Program
06.37 Watch the video available at the link shown below
06.40 It summarizes the Spoken Tutorial project
06.43 If you do not have good bandwidth, you can download and watch it
06.47 The Spoken Tutorial Project Team
06.50 Conducts workshops using spoken tutorials
06.53 Gives certificates to those who pass an online test
06.57 For more details, please write to, contact@spoken-tutorial.org
07.03 Spoken Tutorial Project is a part of Talk to a Teacher project
07.07 It is supported by the National Mission on Education through ICT, MHRD, Government of India
07.14 More information on this Mission is available at the link shown below
07.18 This is Ashwini Patil from IIT Bombay signing off
07.22 Thank You for joining.

Contributors and Content Editors

Jyotisolanki, PoojaMoolya, Pratik kamble