Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading a reg file

Status
Not open for further replies.

Ablecken

Programmer
Jun 5, 2001
130
US
If I have a .reg file I cant seem to read it. Just using the simple code :
Code:
Public Function ReadFromText(sFileName As String) As String
    'On Error Resume Next
    Dim fNum As Integer
    fNum = FreeFile
    Open sFileName For Input As #fNum
    ReadFromText = Input$(LOF(fNum), #fNum)
    Close #fNum
End Function

I get input past end of file. If I manually cut and paste this info from the file into a new text doc it works fine. I cant seem to find any info anywhere as to why this happens. As far as I know there are no hiddent characthers in the file correct?

Thanx a lot guys
 
Nevermind, I figured it out. I had to read it in as binary. Thanx anyway
 
Wait a minute, I was trying to do the same thing, but I can't get mine to work. Can you explain that? All I want to do is read a .reg file line by line in ansi. How?

____________________________________________________________________________
There are only 10 types of people in the world. Those that know binary and those that don't

Brent
 
Brent. You need to read it as binary.

Code:
Public Function ReadFromText(sFileName As String) As String
    On Error Resume Next
    Dim fNum As Integer
    fNum = FreeFile
    Open sFileName For Binary As #fNum
    ReadFromText = String(LOF(fNum), 0)
    Get #fNum, , ReadFromText
    Close #fNum
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top