hi..
i need to read a file..
in tat file i ve to read all strings and compare it with the given string..
hw 2 read strings in file exculding whitespaces n compare it..?
help me...!!!!
cooolguy 0 Newbie Poster
Recommended Answers
Jump to Postuse the >> operator
ifstream in("file.txt"); string word; while( in >> word ) { }
Jump to Postcan u explain it please...........
The code snippet I posted opens a text file and reads it one word at a time. What I did not post was the requirement to compare the words read with some other string -- I left that up for you to do.
All 6 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
cooolguy 0 Newbie Poster
Tom Gunn 1,164 Practically a Master Poster
csurfer 422 Posting Pro
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
cooolguy 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.