Note:- while loop only run when condition is true(means outcome should be 1 ) and in "feof" function gives all the time output 0 till the end of the file ,so ( ! feof gives all time output 1 and at the end of file gives output 0 and we know that while loop stops at 0 ,so while loop stops at end ) I hope this explanation would helpful to you😊
Sir u r like a god for us Your way of teaching is awesome and u r providing all this content for free..thank you sir For helping me and those who are financially weak
Its a greatest effort to teach student by E-medium. Your are not going very fast , with diagram method is too good ,so that a novice student can understand it easily. ( I am doing MCA after B.com and your videos are helping me without any cost). Cheer -full. I am also a subscriber.
sir, if we don't know which type of data already store in file then how we can use char ch; data may be int type or anything else. and i'm not clear about while(!feof(fp)); that statement... why we are using !, and if we are using this loop for read entire data so why we are not using before.. i know you are so busy... if you have time then please sir clear my doubt... GOD bless you & your family member also... your name also in list of my favorite teacher... thank you sir...
@@nishchaybhokare2858 it is predefined function and this - ! use here to specify that loop will work until it not reaches end of file ....if end reaches means function return false and will come out of loop
feop(fp) returns 0(false) when it doesn't encounter end of file and returns 1(true) when it encounters end of file. Now, "!" is logical not operator. So, !(feof(fp)) will imply true, when it is 0 and will imply false, when it is 1. So, while(!feof(fp)) will execute till (!feof(fp)) becomes 1, because 1 will imply false, and simultaneously conditon for the loop also becomes false.
sie feof wali line ki jagah---------> while((ch=fgetc(fp))!=EOF likh re hain to notepad me se adhe character read hoke aa rahe hain..jaise maine notepad me getc likha h to output screen pe sirf gt likh ke aa raha hai..aisa kyun aur isko kaise rectify karenge ?
Sir array, character and string, user defined function, structure and union, pointer, file management in c, dynamic memory allocation and linked lists and Preprocesser ka Topicwis video banayenge to sabhi logo ko bhut hi helpful sahit hoga.
Coz..before while loop it got only one char which is printed once u have entered while loop...but only one char is not there in the txt file,so to print all the remaining chars fgetc()is used inside while loop..here u should note that we have not taken char array we just have taken char type variable so obviously it will store one char at a time and so it is must to use fgetc() again in while loop to get all chars one by one :)
Hi Saurabh jee, I am not sure why we are using fgetc method twice ,its giving the same result if I do not use it outside the while loop,Please explain the need of it outside the loop.
Brother you are right,I think he did it intentionally to show it with both the methods, Outside one shows that it prints only 1 character and increment it to another, but if anyone wants to print it up to the end of file then it should be written in loop.
sir whenever i m trying to use loop my code blocks stop responding..it resond as " your program has stopped working" i have written. the exact code of yours..this has happened to me many times..plz give some solutions
while using fscanf or may be in this case also, reading a string with spaces, gives error, don't know why, If u write a name of Book Harry Potter, means having a space between them, it shoots to infinity in my case....How can we read a file,having a string in it using fscanf??? while(fscanf(fptr,"%d/%d/%d %d %s %lld %s",&.......), you see two %s format specifier, if in file they have a name like Harry potter (having a space between ) ,in file, at the place of any %s, it will shoot to infinity???? Any solution....
Hello, Sir I want to ask that what is the need of 11th line as the respective work will be done by 14th line till the end of a file ? Can we remove the 11th line ?
Bro , the work of action statement in 11th line is to get the first byte's character . And that of 14th line is to assign character of the next byte in the file , as pointer gets incremented so the next byte can be accessed further on
Hi sir, I have write the above same code but my screen is not running or stop and can we use '\0' instead of type NULL because complier is not reading NULL. Please assist.
Sir kase pata chalega k file char return kr rahahe Kuch or v to return kr skta Hain?? Mtlb agr mujha pata Nahi Hain k file k ander kis type a data hain .
sir nested if else bhi add kr dijiye .. students ke liye help hoga ... Maine sare videos yha dkhe .. bt nested If else k liye .. or jgh jna pda ..because wo mere course me tha
Excuse me sir iska matlab file read karne ke liye humare pas allready ek file hona chahiye in my file but i don't know how to make a file ...please......say something abouts it...............
Sir I found some people who download your videos and not watch it on TH-cam. Sir please a make video and scold them after all they are cheating you. Hit like button who agree with me.
i have a doubt, in the video of the link th-cam.com/video/_KW_YBTXhN0/w-d-xo.html he is saying that fopen will give a address of first character of the file, and your are saying fopen will give the address of a structure type variable which is created along with file buffer
thanks for your quick reply. you helped me in a great extent for improving my knowledge in programming thank you very much. your teaching style is amazing.
Note:- while loop only run when condition is true(means outcome should be 1 ) and in "feof" function gives all the time output 0 till the end of the file ,so ( ! feof gives all time output 1 and at the end of file gives output 0 and we know that while loop stops at 0 ,so while loop stops at end )
I hope this explanation would helpful to you😊
Arre Arre bhai... Dil gurde sab jeet liye tune...
Thanks man.
thnx bro
Sir u r like a god for us
Your way of teaching is awesome and u r providing all this content for free..thank you sir
For helping me and those who are financially weak
Sir I know a very little hindi but I can understand all your lectures.
You teach in a very easy way that a donkey wound understand. You are a genius.
Its a greatest effort to teach student by E-medium. Your are not going very fast , with diagram method is too good ,so that a novice student can understand it easily. ( I am doing MCA after B.com and your videos are helping me without any cost). Cheer -full. I am also a subscriber.
Sir meri file open nhi ho rhi hai kya karu.
@@lonewolfmohit file phle bnaye ho? Check krlo ekbaari
Sachin bro please provide your insta account I want to ask something from u
Thank you very much. You are a genius. 👍👍🔝🔝🙏🙏👌👌
your explanation way make you unique sir ☺
Sir i have noticed that when you wrote file type variable instead of pointer ....
Thank you so much sir for providing such knowledge for free...
really sir my concept is being clear one by one after seeing your video ,i am very grateful to you .....thank you thanks you thanks you so much
thank you sir , these videos help me to learn whole c language
Thankuu sir aapki aawaj me jadu hai ,, aap bhut achhe se btate hai ,,,
Thankyou so much sir from ❤❤❤❤❤❤ se
Great work sirr genuine teacher
Sir, ap jo parate age piche sochke parate hai sir , esme concept bahut achcha create hota hai
nice explained,i have cleared that file in one try awesome
Thanku so much sir
I get this concept
U r the best 🙏🙏
Bhai meri file open nhi ho rhi hai
Thankyou very much sir,,,, 🙏👍
Very nice sir
Sir u r the best , really
Sir, aap god hai mere liye... Kuki clg me kya padhate kaise padhate hai wo mujhe samjh nhi aata hai.
Sir mujhe windows ke folder me rakhi file copy karni hai use kaise likhe ge fopen ke andar
Sir,
U tought well bt i could not understand how while loop works here...... How while loop stops
Sir is there any way through c program to read .xls(excel file reading)??
sir,
if we don't know which type of data already store in file then how we can use char ch;
data may be int type or anything else.
and i'm not clear about while(!feof(fp)); that statement... why we are using !, and if we are using this loop for read entire data so why we are not using before..
i know you are so busy... if you have time then please sir clear my doubt... GOD bless you & your family member also... your name also in list of my favorite teacher...
thank you sir...
Yes brother I also have same doubt abou !feof(fp)
But why there is use !
If you know plz reply
@@nishchaybhokare2858 it is predefined function and this - ! use here to specify that loop will work until it not reaches end of file ....if end reaches means function return false and will come out of loop
@@baqirjafri2388 thanks brother
sir ido not understand how (!feof(fp)) will return true(1) or false(0)??
feop(fp) returns 0(false) when it doesn't encounter end of file and returns 1(true) when it encounters end of file. Now, "!" is logical not operator. So, !(feof(fp)) will imply true, when it is 0 and will imply false, when it is 1. So, while(!feof(fp)) will execute till (!feof(fp)) becomes 1, because 1 will imply false, and simultaneously conditon for the loop also becomes false.
I don't understand which pointer is pointing the replica of actual File?..*curp or *buffer...I have confusesion between them
buffer
@12.52 could we have written "ch=fgetc(fp)" just after while loop eliminating the need to write it before while?
yes ur right
sir FILE data type agar struct ki madad se bana hai toh fir woh toh user defined data typr hona chahiye na ?
sie feof wali line ki jagah---------> while((ch=fgetc(fp))!=EOF likh re hain to notepad me se adhe character read hoke aa rahe hain..jaise maine notepad me getc likha h to output screen pe sirf gt likh ke aa raha hai..aisa kyun aur isko kaise rectify karenge ?
👍👍👍👍👍👍
Thankyou sir ji 🙏
Sound volume is very low in each and every video. Rest is great...
Sir array, character and string, user defined function, structure and union, pointer, file management in c, dynamic memory allocation and linked lists and Preprocesser ka Topicwis video banayenge to sabhi logo ko bhut hi helpful sahit hoga.
Sir aap allahabad kabhi ghumne aye hai
I didn't understand why did we used
ch=fgetc(fp);
Again in while loop when it was already used right before while loop.pls explain.
Coz..before while loop it got only one char which is printed once u have entered while loop...but only one char is not there in the txt file,so to print all the remaining chars fgetc()is used inside while loop..here u should note that we have not taken char array we just have taken char type variable so obviously it will store one char at a time and so it is must to use fgetc() again in while loop to get all chars one by one :)
@@nahidafirdose9218 yaa he use before while loop also to explain this otherwise no need to write same line before while
@@sankalpsachan9199 true
Majja aa gaya
Awesome
Hi Saurabh jee,
I am not sure why we are using fgetc method twice ,its giving the same result if I do not use it outside the while loop,Please explain the need of it outside the loop.
Brother you are right,I think he did it intentionally to show it with both the methods,
Outside one shows that it prints only 1 character and increment it to another, but if anyone wants to print it up to the end of file then it should be written in loop.
Bro it gives extra space on output screen
👏 👌 👍🏻
Sir read mode me file ko close karne ki kya zaroorat hai bcz humne to data read karliya ab vo close ho ya na ho usse kya fark padta hai?
sir whenever i m trying to use loop my code blocks stop responding..it resond as " your program has stopped working" i have written. the exact code of yours..this has happened to me many times..plz give some solutions
Add text file in code bock and then run
sir why code block is important
What is the need of fclose() here?
Thanks sir for dis video
Sir,char ch van store only one character so ,how remaining character will store in char ch?
By while loop
thanku so much sir
exit(1) kya he sir ?
without using this exit function we can easily run the prog. so there is no use this exit function..
If mentioned file name in fopen() function is not present in your file labrary Then exit(1) is work..
iska matlab hai pure program sai exit kar jaiega only one-time
Abnormal terminating of program
thankyoy sir🙏
Sir can't we open any existing word document? If so what extension do I have to use?
Anyone? What is difference between getc() function and fgetc() function? we can aso use getc() function instead of fgetc() funtion.
while using fscanf or may be in this case also, reading a string with spaces, gives error, don't know why, If u write a name of Book Harry Potter, means having a space between them, it shoots to infinity in my case....How can we read a file,having a string in it using fscanf??? while(fscanf(fptr,"%d/%d/%d %d %s %lld %s",&.......), you see two %s format specifier, if in file they have a name like Harry potter (having a space between ) ,in file, at the place of any %s, it will shoot to infinity???? Any solution....
file is defined in stdio or stdlib?
Nice
How to read both text and integer from file ?
Hello, Sir I want to ask that what is the need of 11th line as the respective work will be done by 14th line till the end of a file ?
Can we remove the 11th line ?
Bro , the work of action statement in 11th line is to get the first byte's character .
And that of 14th line is to assign character of the next byte in the file , as pointer gets incremented so the next byte can be accessed further on
@@Goku-tt5hb thanks bro
Hi sir, I have write the above same code but my screen is not running or stop and can we use '\0' instead of type NULL because complier is not reading NULL. Please assist.
use #include
I have used #include my screen is run but for a second i am using getch also.
Sachin Goel for getch () u need #include
Bolo Jai mahakaal
sir isame hum kisi or drive mai file bana to nahi sakte pr banani ho to kya kare sir. ????
Sir kase pata chalega k file char return kr rahahe Kuch or v to return kr skta Hain?? Mtlb agr mujha pata Nahi Hain k file k ander kis type a data hain .
where is the playlist of this video
sir nested if else bhi add kr dijiye .. students ke liye help hoga ... Maine sare videos yha dkhe .. bt nested If else k liye .. or jgh jna pda ..because wo mere course me tha
thnq sir
sir, how can i read an img file in c language plz anyone reply...if u know...it,s urgent
Sir if you create through program it will not work
Excuse me sir iska matlab file read karne ke liye humare pas allready ek file hona chahiye in my file but i don't know how to make a file ...please......say something abouts it...............
❤️❤️❤️
if we cannot use fclose() than what will happen
nothing in case of reading only.provided some conditions are there writen while reading.
sir what is this:- (! feof (fp)) ??????
it is a function to check end of file
traverse the file unless n until it ends
Thank u sir
sir i am confuse in buffer and curp pointer .........
is program me 1st character nhi aa paa rha hai?
fgets() return int value
Explation❤️❤️❤️🐒
Sir Meri file open nhi ho rhi hai,kya karu.
Sir i did not get results it seems that file id return
Sir I found some people who download your videos and not watch it on TH-cam.
Sir please a make video and scold them after all they are cheating you.
Hit like button who agree with me.
sir what is the location of file
f1.txt
thsnks..
why u sir not include header files.........................sir
Sir I not understand this command
While(!feof(fp))..
while(!feof(fp)).
Mtlb jab tk end of file nhi aa jaata tb tk loop run karega
Sir how to download codeblock
Sir mera read nehi ho raha hai.....
Msg aa raha hai file.exe has stopped working
i have a doubt, in the video of the link th-cam.com/video/_KW_YBTXhN0/w-d-xo.html he is saying that fopen will give a address of first character of the file, and your are saying fopen will give the address of a structure type variable which is created along with file buffer
I am right, no doubt about it. :)
thanks for your quick reply. you helped me in a great extent for improving my knowledge in programming thank you very much. your teaching style is amazing.
i can undetrstand it can u have a more easy way to understand
sir, please tell me
100 comment
sir please aap ehe ACCHA kam kartey rahiyega karma jarur faal dega!!!
your explanation way make you unique sir ☺
❤️❤️❤️