Question:You develop an application that appends text to existing text files. You need to write a code segment that enables the application to append text to a file named C:\MyFile.txt. The application must throw an exception if the file does not exist. You need to ensure that the other applications can read but not modify the file. Which code segment should you use? 

A Dim fs As New FileStream("C:\MyFile.txt", _
FileMode.Open, FileAccess.ReadWrite, FileShare.Read) 

B Dim fs As New FileStream("C:\MyFile.txt", _
FileMode.OpenOrCreate, FileAccess.ReadWrite, _
FileShare.Read) 

C Dim fs As New FileStream("C:\MyFile.txt", _
FileMode.Open, FileAccess.Read, FileShare.ReadWrite) 

D Dim fs As New FileStream("C:\MyFile.txt", _
FileMode.Append, FileAccess.ReadWrite) 

+ Answer
+ Report
Total Preview: 817

Copyright © 2024. Powered by Intellect Software Ltd