How to read a file line by line in VC++
-
Can anyone please help me to find out a simple way to read a text file line by line in Visual C++ 6. Thanks in advance. Regards, Vikram
-
Can anyone please help me to find out a simple way to read a text file line by line in Visual C++ 6. Thanks in advance. Regards, Vikram
Use
istream::getline
.Prasad Notifier using ATL | Operator new[],delete[][^]
-
Can anyone please help me to find out a simple way to read a text file line by line in Visual C++ 6. Thanks in advance. Regards, Vikram
-
Can anyone please help me to find out a simple way to read a text file line by line in Visual C++ 6. Thanks in advance. Regards, Vikram
And if you are using MFC, there's
CStdioFile::ReadString()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Can anyone please help me to find out a simple way to read a text file line by line in Visual C++ 6. Thanks in advance. Regards, Vikram
Can you be more specific Its a minimum info
WhiteSky
-
Can you be more specific Its a minimum info
WhiteSky
yeah WhiteSky..I am developing a dialog based MFC application, in which i want to read a text file line by line for parsing and identifying certain charaters such as (), *. % etc. So i wanted to read the text file line by line to count occurance of each keyword at each line. Hope this information is sufficient.
-
yeah WhiteSky..I am developing a dialog based MFC application, in which i want to read a text file line by line for parsing and identifying certain charaters such as (), *. % etc. So i wanted to read the text file line by line to count occurance of each keyword at each line. Hope this information is sufficient.
well you can use of David answer
CStdioFile::ReadString
orCFile::Read
:)
WhiteSky
-
well you can use of David answer
CStdioFile::ReadString
orCFile::Read
:)
WhiteSky
thanks very much...but i think CFile::Read reads the specified number of characters at one go. How do we know the size of each line well in advance. Is there any function in CFile that facilitates it?
-
And if you are using MFC, there's
CStdioFile::ReadString()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
I think this will work CStdioFile::ReadString :)
-
thanks very much...but i think CFile::Read reads the specified number of characters at one go. How do we know the size of each line well in advance. Is there any function in CFile that facilitates it?
vikram.vit wrote:
How do we know the size of each line well in advance.
You don't (at least not without a lot of unnecessary code). That's why I suggested
CStdioFile::ReadString()
and notCFile::Read()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb