My input file loos like (20 lines in total)
GCGAGTTCCCCCATGCGTGTCGGCCCCCGCGTCGCTTTTACTATATCCACCCCATTCCAT
TGAAGGTATTTACTTGGGATCAAATACCGACTAGAGTTATTAAATCTTAATGACCTATCC
TAAGTTTAAGTAACCCAGGTACAGTCGTTAGCTTAGTTCCAAGCGTCCCTCACGTGCACT
ACGGTATTCCCCCTCGTCATGTGCAACCCCCCCGCTCAGCGGATTTCCAGCCGGCCAACA
GTTCGACGAGAAGGCATACCCGCCAGGCAACCTACCGGCCACTCCCTGCGCCCGGACCTT
What I want to make looks like
GCGAGTTCCCCCATGCGTGTCGGCCCCCGCGTCGCTTTTACTATATCCACCCCATTCCATTGAAGGTATTTACTTGGGATCAAATACCGACTAGAGTTATTAAATCTTAATGACCTATCCTAAGTTTAAGTAACCCAGGTACAGTCGTTAGCTTAGTTCCAAGCGTCCCTCACGTGCACTACGGTATTCCCCCTCGTCATGTGCAACCCCCCCGCTCAGCGGATTTCCAGCCGGCCAACAGTTCGACGAGAAGGCATACCCGCCAGGCAACCTACCGGCCACTCCCTGCGCCCGGACCTT
In other words, I want to extract multiple lines from text file into a single string.
The below is what I have tried. But it does not work.
Would you please give me a tip about my probelm?
Well, the getline will fail when the end of file is reached, but the for loop continues without checking.
Having said that, it seems to work, providing the input doesn't have more lines than the array.
@greenleaf800073
I may have missed something, sorry if that's the case. But I wondered why you used function concatenateString() rather than the library function strcat() http://www.cplusplus.com/reference/cstring/strcat/
Sure, but why re-invent the wheel, that's extra work coding, testing, debugging, when there's a fully tested library function available?
The only good reason I can think of is to add extra functionality or overcome some defect of the library function. That's why I asked, I was trying to figure out the what the advantage was.