supposing i made a .txt file and put string like
123+abc
456+def
then how can i read 456 after 123 in case 123 is not that number i want
i tried getline() but i dont know how to read 123 and pass to next line when i tried, it doesnt work
#include <iostream>
#include <string>
#include <fstream>
int main(){
int check=0;
ifstream myfile;
myfile.open("texttext.txt");
string tmp_string;
int tmp_int;
while(!myfile.eof){
tmp_string=getline(myfile);
getchar(tmp_int,tmp_string);
if(tmp_int==the_number) {
check=1;
cout<<"found it"<<endl;
break;
}
}
myfile.close():
if(check==0) cout<<"non match"<<endl;
return 0;
}