Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
2000 Server Services File
Message
From
04/11/2002 03:05:50
 
 
To
01/11/2002 14:04:46
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00717955
Message ID:
00718385
Views:
15
You can set reference (Project|References...) to "Microsoft Scripting Runtime" and use code like this:
Dim FSO As Scripting.FileSystemObject
Dim FileStream As Scripting.TextStream
Dim FileContent As String
Dim StartPosition As Long
Dim EndPosition As Long
Dim LineContents As String

  Set FSO = New Scripting.FileSystemObject
  Set FileStream = FSO.OpenTextFile("C:\WINNT\SYSTEM32\DRIVERS\etc\Services")
  FileContent = FileStream.ReadAll
  StartPosition = InStr(1, FileContent, "van52", vbBinaryCompare)
  If StartPosition > 0 Then  'Line is founded
    EndPosition = InStr(StartPosition, FileContent, vbCr, vbBinaryCompare)
    LineContents = Mid(FileContent, StartPosition, EndPosition - StartPosition)
  End If
  FileStream.Close
  Set FileStream = Nothing
  Set FSO = Nothing
After this, extract number from founded line.

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Previous
Reply
Map
View

Click here to load this message in the networking platform