2005-04-12 Dick Porter <dick@ximian.com>
[mono.git] / mcs / class / Microsoft.VisualBasic / Test / standalone / 6994.vb
1   '\r
2   ' Copyright (c) 2002-2003 Mainsoft Corporation.\r
3   '\r
4   ' Permission is hereby granted, free of charge, to any person obtaining a\r
5   ' copy of this software and associated documentation files (the "Software"),\r
6   ' to deal in the Software without restriction, including without limitation\r
7   ' the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
8   ' and/or sell copies of the Software, and to permit persons to whom the\r
9   ' Software is furnished to do so, subject to the following conditions:\r
10   ' \r
11   ' The above copyright notice and this permission notice shall be included in\r
12   ' all copies or substantial portions of the Software.\r
13   ' \r
14   ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
15   ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
16   ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
17   ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
18   ' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
19   ' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r
20   ' DEALINGS IN THE SOFTWARE.\r
21   '
22
23
24 Imports Microsoft.VisualBasic\r
25 \r
26 Public Class TestClass\r
27     Public Function Test() As String\r
28 \r
29         ' MSDN: With files opened for Binary access, \r
30         ' an attempt to read through the file using the Input function until \r
31         ' EOF returns True generates an error. \r
32         ' GHT: This behaviour is not reproducable\r
33         Dim c1 As Char\r
34         Dim fn As Integer\r
35         \r
36         '// make sure all files are closed\r
37         Microsoft.VisualBasic.FileSystem.Reset()\r
38 \r
39         '// create a file for the test\r
40         Dim SourceFile As String\r
41         Dim DestinationFile As String\r
42         SourceFile = System.IO.Directory.GetCurrentDirectory() + "\data\textfile.txt"\r
43         DestinationFile = System.IO.Directory.GetCurrentDirectory() + "\data\6994.txt"\r
44         Dim f As System.IO.FileInfo = New System.IO.FileInfo(DestinationFile)\r
45         If (f.Exists) Then\r
46             Kill(DestinationFile)\r
47         End If\r
48         FileCopy(SourceFile, DestinationFile)\r
49 \r
50         fn = FreeFile()\r
51         FileOpen(fn, DestinationFile, OpenMode.Binary)\r
52         Do While Not EOF(fn)\r
53             Input(fn, c1)\r
54         Loop\r
55         FileClose(fn)\r
56 \r
57         Return c1\r
58     End Function\r
59 End Class\r