C++ Tutorial for Beginners 43 - How to Read from a .txt file using C++

preview_player
Показать описание
★★★Top Online Courses From ProgrammingKnowledge ★★★

★★★ Online Courses to learn ★★★

★★★ Follow ★★★

DISCLAIMER: This video and description contains affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This help support the channel and allows us to continue to make videos like this. Thank you for the support!
Reading whole file into std::string
c++ - Read file line by line
C++: Read file line by line
c++ - How to read line by line or a whole text file at once
Reading and writing text files in Open C++
C++ File I/O Tutorial
Reading Line by Line from Text File into
Reading information from a text file
c++ read text file line by line
c++ open text file for reading
reading integers from a text file in c++
reading words from a text file c++
file read cpp
c++ read file getline
ifstream read whole file
c++ read whole file
Рекомендации по теме
Комментарии
Автор

Can skip to 5 minutes in for what you need to know about reading in for a file.
Thanks, this helped me a lot!

RevinDay
Автор

Code works perfectly. One note though, if you are using "namespace std", there is no need to precede a statement with std:: . Otherwise thank you for the video.

dmoney_thegreat
Автор

you don't have to write std whenever you call cout or cin, since you already mentioned the namespace before the main function.

endless_paradigm
Автор

Code never ran for me. :( even though I followed all his instructions

daniellenagy
Автор

After searching multiple videos, I got an easy & clear understanding about the topic from this vidoe. Thank you so much.

adibahbab
Автор

Brilliant video, LIFE SAVER thank you very much. Clear, precise and great explanation. I had been searching all over the net to do something simple like this yet couldn't find any good quality info or video.

ronz
Автор

Thanks. My professor explained this well, just in possibly the dullest and most boring way possible.

djdoole
Автор

You can use endl, when you want to make the text to go to the next line.

radoslavl
Автор

i used this and the other tutorial for my console game!

thegamevortex
Автор

Great video! One question: If my text file's data is separated by commas, how do I read the data to the terminal without including the commas? I know i'm supposed to use getline since it gets rid of the commas, but I'm not sure about the notation.

Thanks for your help!

QuertyRow
Автор

THANKS A LOT ! I kept trying to find the asnwer on stackoverflow, but you were the only one who could help me ^-^

wooperbestpokemon
Автор

Yes. Thank you. I've been stuck on this for hours.

pqsiolw
Автор

Im having this problem that i have to construct a program to read my file where i have to provide choice for the user to select. Like i saved names and roll numbers in my file and now i have to provide option to user to select which roll number's name should be displayed/read

anikatahir
Автор

Thank You...!! It helped a lot.!!
I have a question.If we want to read only the even lines in that file or vice versa...how should we go about it....????
And also can the read lines be stored in the

visakeswaran
Автор

Thank u so much. It is such a clear explaination!

smplelance
Автор

how can we skip multiple lines in multiple time while reading the text file ???

devendraverma
Автор

I just have a question, what if i want to read using the operator " >> ", and at the same time, i want to exactly know when a new line starts and i start to read from a new line, and everytime i start reading from a new line, i want to increment an integer called LineNumber, how can i know the end of a line using this operator " >> " for reading?

MyFavSongs
Автор

Best Tutorial sir, But my file is comma separated what will be the syntax for it... (12.50 Min).. Please reply

saurabhfodekar
Автор

You dont have to write std:: shen you have using namespace std; library

lukalazic
Автор

hello i tried your code and it keeps on telling me that the file is not open what should i do?

Yasjunmine