Category : txt

Until now I always had txt files that were ordered like this: 0.23432 0.12232 0.56765 For this I could simply use this code std::vector<double> Readseq; std::ifstream myfile; myfile.open(FileName); if (!myfile) { std::cout<<"Error, cannot open recordingdata.txt n"; } if(myfile.is_open()){ while (myfile>>element){ Readseq.push_back(element); } } myfile.close(); However, I now have text files that are structured like this: ..

Read more

Until now I always had txt files that were ordered like this: 0.23432 0.12232 0.56765 For this I could simply use this code std::vector<double> Readseq; std::ifstream myfile; myfile.open(FileName); if (!myfile) { std::cout<<"Error, cannot open recordingdata.txt n"; } if(myfile.is_open()){ while (myfile>>element){ Readseq.push_back(element); } } myfile.close(); However, I now have text files that are structured like this: ..

Read more

Hello i am trying to read and print the contents of my text file which just says hello but it doesn’t print anything out. int main() { string input; char filename[50]; ifstream infile; cin.getline(filename, 50); infile.open("HI.txt");// txt file if (!infile.is_open()) { exit(EXIT_FAILURE); } char word[50]; infile >> word; while (infile.good()) { cout << word << ..

Read more