c++ - Comparison of string with the File data -


i m stuck in simple problem ,this code part of programme takes data user , reads data file(that contains name of movies , actors) , compare input gives wrong result.this code

#include<iostream> #include<fstream> using namespace std; int main() {     string name;     getline(cin, name);     string compare;     ifstream myfile;     myfile.open("movie.txt");     bool found = false;     if (myfile.is_open())     {         while (getline(myfile, compare))         {             if (compare == name)             {                 cout << "record found" << endl;                 found = true;             }         }         myfile.close();     }     if (found)         cout << "not found" << endl; } 

any regarding appreciated . thanks

for debug can use string_to_hex here on both compare , name


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

html - Outlook 2010 Anchor (url/address/link) -