jskfan
asked on
FileStream in VB.net
I have some questions regarding the code below:
Dim sdirectory as string="C:\vb.net\files"
dim sfile as string="example.txt"
dim spath as string= sdirectory & sfile
dim sfilestrean as filestream
sfilestream=new filestream(spath,filemode. open,filea ccess.read write)
1-can I just use: dim spath as string="C:\vb.net\files\ex ample.txt" instead of declaring Dim sdirectory as string="C:\vb.net\files" then dim sfile as string="example.txt"?
2-when I put filemode.open, Fileaccess.write or Fileaccess.readwrite or Fileaccess.read or Fileaccess.none. Does this mean if that file exists and accesseb by another user while this code is running can allow/prevent that user from read or write? please explain.
3- when I put filemode.createnew, Fileaccess.write or Fileaccess.readwrite or Fileaccess.read or Fileaccess.none. Does this mean if that file exists and accesseb by another user while this code is running can allow/prevent that user from read or write? please explain.
Thanks
Dim sdirectory as string="C:\vb.net\files"
dim sfile as string="example.txt"
dim spath as string= sdirectory & sfile
dim sfilestrean as filestream
sfilestream=new filestream(spath,filemode.
1-can I just use: dim spath as string="C:\vb.net\files\ex
2-when I put filemode.open, Fileaccess.write or Fileaccess.readwrite or Fileaccess.read or Fileaccess.none. Does this mean if that file exists and accesseb by another user while this code is running can allow/prevent that user from read or write? please explain.
3- when I put filemode.createnew, Fileaccess.write or Fileaccess.readwrite or Fileaccess.read or Fileaccess.none. Does this mean if that file exists and accesseb by another user while this code is running can allow/prevent that user from read or write? please explain.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
filemode.open, Fileaccess.write
and the file was already open by another user for reading or writing , what would heappen?