Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 22151

open for input - getting corruption when reading exported registry files...

$
0
0
Code:

    Dim iFileNumber As Integer, sLineText As String
    iFileNumber = FreeFile
   
    Open App.Path & "\temp.reg" For Input As #iFileNumber
    Do While Not EOF(iFileNumber)
        Input #iFileNumber, sLineText
        Text1.text = Replace$(sLineText, "ControlSet002", "CurrentControlSet", , , vbTextCompare)
    Loop
    Close #iFileNumber

When reading an exported registry file (.REG) I get all sorts of corruption at the beginning of the line text, like "ÿþ" and other things -- things I don't SEE when viewing the file in notepad.exe -- how can I effectively strip this garbage from the results?

I would do strip(slinetext, "ÿþ") but there's a lot of different garbage in there and results are whacky even when I try it, like it inserts extra line feeds after = characters, and other things... Also, you may see in text1.text "ÿþThen Normal Text After That" but if I actually try to write a new text file, it appears that the ÿþ garbage at the beginning of the line makes the entire line written as just a bunch of square blocks.

Obviously my goal is to export a registry file, replace the text in each line, and re-import it.

Any help is appreciated!

Viewing all articles
Browse latest Browse all 22151

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>