File Handling in C++ Programming
ฝัง
- เผยแพร่เมื่อ 3 พ.ย. 2024
- Support Simple Snippets by Donations -
Google Pay UPI ID - tanmaysakpal11@okicici
PayPal - paypal.me/tanmaysakpal11
--------------------------------------------------------------------------------------------- What are files and streams?
Files are used to store data permanently.
A stream is an abstraction that represents a device on which input and output operations are performed.
A stream can basically be represented as a source or destination of characters of indefinite length.
Three file handling data types :
ofstream : This data type represents the output file stream and is used to create files and to write information to files.
ifstream : This data type represents the input file stream and is used to read information from files.
fstream : This data type represents the file stream generally, and has the capabilities of both ofstream and ifstream which means it can create files, write information to files, and read information from files.
File Handling in C++ Theory Article - simplesnippets...
Simple Snippets Official Website -
simplesnippets...
Simple Snippets on Facebook-
/ simplesnippets
Simple Snippets on Instagram-
/ simplesnipp. .
Simple Snippets Google Plus Page-
plus.google.co...
Simple Snippets email ID-
simplesnippetsinfo@gmail.com
Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌
ok
Nice explanation but I have few questions
Why we used arr[100] and arr1[100] ? and
I tried using only arr[100] but it prints only the value given during that compiling and it appends whole value
You simply Marvelous❤️
randomly studying on yt 1 day before exam .... :P
Hahaha this is exactly what I used to do 😉
Same here bro 🔥
randomly studying on yt 2 hours before the exam :P
And after three years of this comment here I'm doing the same🤣👍
Legacy of engineers bro
@@vedantshirpurkar1833 after 2 months i am also doing the same🥲
Best subscription request ever! It came out of nowhere and just had to hit subscribe the moment you mentioned it. Great video, never stop.
Thank you so much buddy 😊 glad to hear this from you ✌️ and yes surely will keep putting out more content on the channel 😊
@@SimpleSnippets You havent used ios::in ....
It's unreal how comprehensive you make these subjects to be man. Another 16 minutes well spent for me. Thanks a lot for putting out this content
Thank you so much man, all the other yt videos just go on saying bookish definitions all the time, but your down right 1 on 1 ish language and explanation is so much more easier to understand.
Really like the way you do "so if I were to make this change , so and so would happen " and compile&run .
Thank you so much buddy for such wonderful feedback. This means a lot. I would request you to please share the videos and our channel with your friends too. That's the biggest help and support 🤟✌️
The '|' is a pipe, it is used here to connect the different streams together.
its actually a bitwise operator and it "OR"s two bitfields which are used as a flags internally to specify the behaviour of the filestream operations.
Bro my friend name also Tanmayi she loves your channel and says she is thankful for learning c++ so easily. You also helped me, thank you bro. Cheers
Thank you so much Harsha for such a wonderful compliment. Most welcome to you and your friend as well. I am glad to hear that my videos helped you. I would request you to please share the videos with your friends too ✌
You have no idea how helpful rhis is... sometimes while reading from the book....you may get stuck as what is the use of this operation...thankyou so much sir...!!!
Thanks Vivek for such a positive and kind feedback. I'm really glad to hear this from you and that this video helped you. I would request you to please share the videos with your friends too ✌️
Omg this helped me out a lot.
I was struggling with it
Thanks for explaining mn
Keep up the good work
Most welcome buddy 😁 I would request you to please share the video with your friends too 🤟
Great and simple vid🔥 that explained me everything I just wanted...thx bruh...👍🏻
Glad to hear it!
Love you man due to your video i completed my lab task in 20 mins thank you very much
May ALLAH bless you..Ameen
Oh my god you need so little code to read input, create a file, write to a file and then read from a file!
That's so awesome! Compared to java, cpp so far is looking damn amazing!
You explained it like a boss bruh 🔥🔥🔥
Hey soham, Thank you so much buddy. Really glad to hear this from you. Please do share the video with your friends too. That'll be the best help and support for the channel ✌️😋
Very clearly explained ..... Thank you simple snippets for clearing my concepts..
That's great to know Ankita 😊 please do share the videos and channel with your friends that's the biggest help & support you can provide ✌️
@@SimpleSnippets yeah definitely!
You have been fabulous in describing every single line , thank you for explaining in such a detail.
Keep it up
Thanks a ton 😇 Please subscribe and do share our channel with your friends too. Thats the biggest help and support 😇
SUPERRRRR BRO.
👌👌FANTASTIC EXPLANATION 👏👏👏watching video a day before exam
Thank you so much buddy, Please do share the channel with your friends too. Thats the biggest help and support 🙂
@@SimpleSnippets definitely
You're very clear and to the point, thank you very much. Keep up the good work.
U r the best ever mentor for anyone to everyone.
Please start a series of ds algo questions also.
Amazing 💯 thankyou so much... you cleared all my doubts
Glad to hear that
Awesome video explains everything in brief.
Thank you so much buddy. Glad to hear your positive feedback 😊
Please do share the video with your friends and contacts too 😊✌️
Awesome Tanmay. Too good man
u know that iostream is a derived class of fstream
so if u are including fstream then u dont need to include iostream
fstream is subclass of iostream. So we have to include the parent class in program.
Yeah. Try doing std::cout, std::cin without including iostream.
@@ilovemove1
you have to use std:: when you have not mentioned that you're using namespace std, not iostream.
aboslutely magnificent explanation
Tanmay! u r doing great job by teaching us online.i have to learn DS(data structure) also;i wud be very grateful to u if u could make videos on ds
Thank you so much bro. And yes I will be starting with DS probably next month because in this month I'm statring with website development from scratch Using HTML CSS JS and bootstrap framework which I'll start from 15-20 Dec. After I finish that mostly it's going to be data structures only 😇✌️
Thank you so much!!!You taught me exactly what I expected for🙏
Great Work, Keep it up.
Thanks buddy! Please share the videos with your friends if you want to genuinely support me & our channel!✌😇
@@SimpleSnippets
Yes why not !
Talented teacher God bless you
You have done a really good Job. Thank you so much. Keep it up 👍
Thank you buddy, please do Subscribe to our channel as we have a lot tech educational content which you'll surely like. Also please do share our channel and videos with your friends too, that's the biggest help and support you can provide buddy ✌
Thank you man for the justification
Glad you liked it! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Nice concept..... understood very well.....so much thanks.....keep uploading useful videos...
Thanks Atul 😊 there are many more videos on this channel. Please do share it with your friends too 😊✌️
I really owe you
Your videos helped me in learning the imp programs and understanding them right before my exams thank you 😭😭💜💜💜💜💜
Good job mate. Great explanation.
Thank you so much buddy. Glad to hear your positive review. Please do share the video with your friends and spread the knowledge 😇
Simple Snippets Certainly. If I may ask, do you guys have a video about the seekg, seekp, tellg and tellp functions?
Or perhaps you can provide an explanation in layman terms.
As of now I don't have a video tutorial on this topic but I'll surely make a video on this. I do have covered almost all the basic concepts in the C++ programming for beginners playlist.
Coming to your question, I won't be able to explain in very easy terms in a comment and I'd prefer to show this in a video itself. However in the meantime I have got a website content which seems to give a easy theoretical explanation to these functions
Here's that web link -
enggedu.com/tamilnadu/university_questions/question_answer/be_nd_2007/3rd_sem/cse/cs1204/part_b/13_a_1.html
Simple Snippets Thanks a ton bro.
thank you for sharing your great wisdom
You are so welcome
Awesomeness appreciated 👍🏻👍🏻👍🏻 thanks a lot 💯💯💯
Thanks Siddhesh, please do share the videos & our channel with your friends too. Thats the biggest help and support you can give back to this channel! 😇
In just 16 mins u taught me the whole thing.
Hey, I really enjoyed your tutorial. It helps a lot. Btw do you teach also if someone request?
Thank you very much. As of now I am not taking any such private coaching opportunities but I do intend to do it in future.
Thanks alot ! I didnt understand this in Campus for my assignment but now i do, keep up the good work!!❤️🔥💥😍 SUBSCRIBED😁💜
Most welcome bro 🤟 very happy to hear this from you 😊
The lecture was really awesome and you explained it really well. But i felt the need of explaining the catch block in a bit more detailed manner along with its type and also universal catch block.
I have a separate video on try catch block all together. Also thank you for the compliments 😇
Very well explained ! Thanks !
nice work bro lv u
Thank you bro 😇 please do share the video with your friends too. That's the biggest help and support you can provide ✌️
@@SimpleSnippets thora sa networking pe bhe aoo bro boht need hy
Tqs u so much sir...... Super explanation
best explanation ever seen
this was amazing ! esp coz it wasn't boring... some other videos made me sleep but this one's good
Hehe thank you do much Kusum. Really happy to hear this feedback from you ✌️
Do share the video with your friends too! That'll be great help 🙏✌️
God bless you. Keep up the good work.
Thankyou you have described great
You are great !!!!
I have no words for you bro, awesome wonderful amazing superb great work
and yeah I forwarded it to all my friends, relatives and girlfriends, you need not repeat 😉
Hey, u first have said that fstream is a class then u said that it acts as a datatype... What does that mean ???
...
..
Secondly if myfile is a constructor, then “xyz.txt ” is argument ???
..
..
Plz answer...btw u r going an amazing work...keep going buddy ..💟
thank you for clear explanation
one doubt
how to append the text in separate lines...
and how to get the text in the txt file as output when appended line by line
Thank You!
You're welcome! Please do share the videos and channel with your friends too. Thats the biggest help and support you can give!
@@SimpleSnippets yes I will!
Good job great explanation 👌
Thank you Shazma. Please do share the video with your friends too 😇
@@SimpleSnippets yea sure buddy
Thank you 😊
@@SimpleSnippets ua welcome
Bro you frickin saved my ass
Thank you so much buddy 😊 glad to hear this from you 🤟
Awesome explanation
Thanks bro. I would request you to please share the videos and channel with your friends and contacts buddy. That will be the best help 😁✌️
of course
Thank you so much ❤️
Any time!
Best .explaination in vry short period of tym
Thank you so much buddy. Please do share the video with your friends too 🙏😇
You are awesome thank you
Thank you buddy, please do Subscribe to our channel as we have a lot tech educational content which you'll surely like. Also please do share our channel and videos with your friends too, that's the biggest help and support you can provide buddy ✌
Thank you so much sir .
Most welcome buddy, glad to hear this from you. Please do share the videos with your friends too 😇
The ending 😂😂
"Peaceee ✌" Lol😂
thank you so muchhhh!!!!
You're welcome!
really like this video👍
Great man👍
Thank you so much.. great explaination
Thank you so much buddy. Glad to hear this from you. Do share the video with your friends and contacts too. That'll be the best support 😇
Also I just noticed, even you have your own youtube channel which has Chemistry related content. Thats so cool ✌
nice work buddy
really good, helpful .... 👍
Glad it was helpful!
@@SimpleSnippets yes 🙂
Useful 🔥 ❤
Would you recommend using C++ streams over C style IO all the time? I've seen people use the latter in many cases, and I've always been confused as to why.
Im so done with my teacher yar .... Kal paper hay aur ajj extra class lekar file handling samjha rahay
ifstream and ofstream are inherited from fstream, not fstream been derived from if and of streams. Great video
thank you.
Most welcome buddy 😬
Thnx u really helped me in my assignment 😊😊👍👍
Most welcome Diksha. Glad to hear this. I would request you to please share the video with your friends too 😁✌️
For sure😊
@@dikshak.9794 thank you Diksha 😊✌️
Clearly Explained Dude......😘💝
THank you so much Karthik. Really happy to hear this from you. Please do share the video with your friends too. 😇✌
ultimate bro
Thanks bro 😁✌️ please share 😊
In your theory article, you have given some more things which are also in my Textbook and you haven't explained those things like the binary file handling. I had to see another video on TH-cam for that.
keep up the goodwork buddy !! :)
Thanks, will do Sagar! 😇
thank you so much you are the best
This was so helpful! Thanks for this.
+sammy hello, you're welcome. Is great to hear you positive response. Do share the video when your friends and contacts ✌️😇
Hello , I have question. Im stuck in here
cout
Great video sir. I only have one question, how do I make it so that the .txt file contents have a space every time the program is ran?
For example:
If I run it twice and have the text file content as "SimpleSnippets"
I want it to become
Simple
Snippets
not
SimpleSnippets.
Thank you so much!
u can use loops
by using i as infinite number of lines ..........
thank you for good videos
Most welcome buddy 🤟 I would request you to please share the videos with your friends too ✌️😊
@@SimpleSnippets Sure Bro
Thanks bro ❤
Most welcome buddy. Please do share the video with your friends & contacts 😇
great learning received
similarly can you take class on java , i love the way u teach
Hello I already have core java programming tutorials on this channel, just check the playlists buddy 😇
And thank you so much for the compliments ✌
I did the same process but my file is not created on same location and I can't be able to find where is my file
gjb bhai gjb
Thank you Karan bhai 😇 please do share the video with your friends too. That's the biggest help and support you can provide ✌️
Too good bro
😮😮😮😮
Thanks Adarsh 😊 please do share the video with your friends too 😊
Thanks bro
Is it necessary to write ios::app(are there any other variables of objects that clashes with ios::app...)
you are the best........masum
Thanks you very much
Hey just a random question, that your took array size 100 randomly for more than enough memory space for our task. But I didn't understand how the arrays is being filled when we're giving the input in line? Out of curiosity I changed the array size to 3 and tried giving input as "axe" but only 2 characters were saved. So why is it saving one less than the size declared? Also it is not that "tanmay 21 " is one entry for the array, instead 8 entries or 9 entries if space is also counted. So what should be the minimum size of the character array for the entry "tanmay 21"?
Sir, Is this Reading and manipulation of text from an already existing file(accessing sequentially)?
Yes ✌️
Great explanation...please make videos on linear and binary search.
Thanks bro. Yes I will soon cover those topics in our on going Data structures and algorithms topic 😊
@@SimpleSnippets Thanku sir!!
Most welcome buddy 😊
Awesome initiative bro!!!! cout
Thank you buddy, really appreciate this kind feedback. Please do share the videos with your friends too, Thats the biggest help and support for our channel 😇
How can I access/create files with a location other than that of the exe. file?
Cool brother 😍😍😍😍
Thanks bro 😊✌️ please do share it with your friends 😊
@@SimpleSnippets I am sharing your brother please do check out and share mine
th-cam.com/video/lgPMnb03lXE/w-d-xo.html
Wow just checked your channel. You have amazing Talent Shuvam. keep up the great work and share your creativity ✌
You made CS the most easiest sub....thnx...
Thanks buddy! I am glad to hear this from you 😇 Please do share this video with your friends too & definitely subscribe to this channel 😇
I successfully save the data in the file but if i run the program the second input will be on the same line. So can i know the way to let the second input display at the another line? Where should i put the endl in the program?
Please make videos on java,If you can.Your explaination is great...
Hey Purva, I've already made a playlist on core java buddy ✌️ here's the full link - th-cam.com/play/PLIY8eNdw5tW_uaJgi-FL9QwINS9JxKKg2.html
Also there's a lot more on the channel so please do check it out I'm sure you'll like it 😊
Excellent ..
@@purvapawar6843 do turn on the notifications for this channel if you have subscribed cause a surprise news is coming soon for all the subscribers 😋
Give example of binary files too...
Nice colors.
Thank you 🤗