Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read all lines from multiple text files.
#1
Hello. Nice site.

I just recently viewed on of the BP youtube tutorials on how to get all the files from a certain directory.

I was wondering if there was a way of amending it so that every line of every text file in a directory could be stored into an array?


Thanks.
Reply
#2
Hello strawman83!

First off, welcome to BP Forums!


As for your question, the answer isn't too complicated. SImply loop through all the files in a directory, create a new StreamReader and a new List<String> for each file. Then, as you read lines using the StreamReader, add those lines to the list.


If you need more help, especially with the details of the code, do let us know!
My Blog | My Setup | My Videos | Have a wonderful day.
Reply
#3
(05-30-2015, 05:19 PM)brandonio21 Wrote: Hello strawman83!

First off, welcome to BP Forums!


As for your question, the answer isn't too complicated. SImply loop through all the files in a directory, create a new StreamReader and a new List<String> for each file. Then, as you read lines using the StreamReader, add those lines to the list.


If you need more help, especially with the details of the code, do let us know!

Thanks brandonio, I managed to figure it out from your advice.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to: Search files from a certain directory with Progressbar + Backgroundworker ryanshane91 0 183 10-31-2017, 07:25 AM
Last Post: ryanshane91

Forum Jump:


Users browsing this thread: 1 Guest(s)