Question: I am trying to read and write to multiple files, but am having trouble making the code work. The code should point and read/write to

I am trying to read and write to multiple files, but am having trouble making the code work. The code should point and read/write to multiple files. I know how to make it work with single file, but need help pointing to multiple files.I have the code below.

public BaseResponseMessage Daily(){

BaseResponseMessage respo = new BaseresponseMessage();

try

{

FileStream fi = File.Open(Here I point to a file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

BufferedStream b = new BufferedStream(fi);

StreamReader s = new StreamReader(b);

Stringline;

String output = "success";

Directoryinfo di = new Directoryinfo(Points to directory);

Directoryinfo[] dir = di.GetDirectories();

foreach(Directoryinfo dri in dir)

Console.WriteLine(dri.Name);

while ((line = s.ReadLine() )!= null)

{

output += line;

line = s.ReadLine();

}

s.Close();

respo.message = output;

respo.success = true;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!