In my case I have five huge text files,which I have to embedd into one text file.
I tried with StreamReader(),but I don’t know how to make it Read one more file,do I have to assign another variable?
Showing an example will be appreciated greatfully.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
New answer
(See explanation for junking original answer below.)
This new answer is quite like Martin’s approach, except:
Original answer
Martin Stettner pointed out an issue in the answer below – if the first file ends without a newline, it will still create a newline in the output file. Also, it will translate newlines into the “\r\n” even if they were previously just “\r” or “\n”. Finally, it pointlessly risks using large amounts of data for long lines.
Something like:
Note that this reads line by line to avoid reading too much into memory at a time. You could make it simpler if you’re happy to read each file completely into memory (still one at a time):